Introduction: using proxy configuration in Mule with HTTP
A lot of companies are connecting to the web via a proxy, most of the times all the traffic to the outside world is routed through a proxy before it reaches the destination.
So employees have setup the proxy configuration in their web browsers so all the requests are sent via the proxy.
In Mule, outgoing HTTP requests are similar to request from a browser so most of the times the proxy configuration needs to be used.
In the Global HTTP Request Configuration the proxy can be configured in the Proxy tab.
In the screenshot both the host and port are (of course) example values, username and password maybe necessary in your scenario.
So when using an HTTP outbound endpoint and you refer to this Global Configuration your traffic is routed via the proxy config you provided.
Web Service Consumer behind a proxy
Using the Web Service Consumer connector to consume SOAP webservices with Mule is very simple and effective.
When using a Web Service Consumer connector you need to add a Global Connector Configuration, as with most of the connectors in Mule.
The only thing that you need to provide a WSDL file, that can be a file that is accessible via the web or a file that is stored locally in your Mule project.
In this example i used a WSDL file that is public available via the following URL:
The other fields are populated automatically when the WSDL is parsed.
Because all traffic needs to be routed via the proxy, that is also the case with this SOAP webservice, it a call and a response over HTTP.
There is no Proxy tab in the Global configuration of the Web Service Consumer connector.
Well here is the trick, you need to setup to a HTTP Request Configuration that contains the host settings of the web service and the proxy configuration.
So in the case of the provided example that will be:
Again, in the screenshot both the host and port are (of course) example values, username and password maybe necessary in your scenario.
Next step is to refer to the created HTTP Request Configuration at the Web Service Consumer Global Element.
Using proxy settings on Mule ESB server instances
When you run Mule ESB instances on premise the proxy settings can be passed in as JVM parameters.
Best way to do this is by adding them in the wrapper.conf file
Example with the values from the previous steps
Make sure you change to the next available number, default is 15, 16
You can use the code in Anypoint Studio
When using the code you will see the Global HTTP Request Configuration.
In the flow it won’t show up, you will only reference it via the Web Service Consumer Connector
Pass in a query parameter (eg. CAD/USD/GBP)
Change the proxy settings, watch the connectorConfig attribute on the ws:consumer-config