Contact Free trial Login

Proxying Web Services

MuleSoft recommends against deployments to Mule 3.8. Standard Support for this version ended on November 16, 2018, and Mule 3.8 will reach its End of Life on November 16, 2021, when Extended Support ends.

Mule can act as a Web Service proxy to perform several useful functions:

  • Routing to the appropriate backend service (whether remote or local)

  • Message transformations, such as converting from old versions of the message format

  • Protocol bridging, such as HTTP to JMS

  • Validation

  • Security enforcement

  • WS-Policy enforcement

Instead of building a proxy application from scratch, consider using an Anypoint Platform Proxy. Mule provides several utilities that help you do this:

  • Protocol bridging - allows you to forward requests from one endpoint to another. This is generally the best option for proxying Web Services.

  • WSProxyService - allows you to service WSDLs locally while proxying remote web services.

  • Proxying Web Services - perform WS-Security or WS-Policy actions, route based on information such as the operation or SOAP Action, and easily work with just the payload by taking advantage of CXF’s web service capabilities.

The following sections provide more information on these utilities.

Protocol Bridging

The simplest type of Web Service proxy just involves forwarding a request from one endpoint to another via service bridging. You can forward the data streams directly, or you can process and transform the XML. If you are doing content-based routing, this is often the best option, as it will add less overhead than a full CXF proxy (which is only needed in certain cases).

Following is a simple configuration example that forwards a request from one HTTP endpoint to another:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http=""
    xmlns="" xmlns:doc="" xmlns:spring=""  xmlns:xsi="" xsi:schemaLocation="">
    <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8888" doc:name="HTTP Listener Configuration"/>
    <http:request-config name="HTTP_Request_Configuration" host="[header:INBOUND:http.request]" port="8888" doc:name="HTTP Request Configuration"/>

  <flow name="HttpProxyService">
      <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <http:request config-ref="HTTP_Request_Configuration" path="#[message.inboundProperties.'http.listener.path']" method="#[message.inboundProperties.'http.method']" doc:name="HTTP"/>

This type of bridge can be combined with filters for easy message routing. For fast XPath routing of messages, you can use the SXC Module Reference.


The WSProxyService allows you to serve WSDLs locally while proxying remote web services. This is handy when you have an alternate WSDL you want to service, or if you don’t want WSDL requests to be routed with all the other SOAP message requests. Any request that comes in with a "?wsdl" attached to the HTTP URL will be redirected, and the specified WSDL will be served instead.

To configure this in your flow, you must first define a WSProxyService bean with your WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http=""
    xmlns="" xmlns:doc="" xmlns:spring=""  xmlns:xsi="" xsi:schemaLocation="">

    <spring:bean name="WSProxyService" class="org.mule.module.cxf.WSProxyService">
        <spring:property name="wsdlFile" value="localWsdl.wsdl"/>

Next, define your service bridge to use this component:

<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8080" doc:name="HTTP Listener Configuration"/>
<http:request-config name="HTTP_Request_Configuration" host="acme.come" port="8080" basePath="remote/web/service" doc:name="HTTP Request Configuration"/>

<flow name="HttpWebServiceBridge">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/my/service" doc:name="HTTP"/>
         <spring-object bean="WSProxyService" />
        <http:request config-ref="HTTP_Request_Configuration" path="#[message.inboundProperties.'http.listener.path']" method="#[message.inboundProperties.'http.method']" doc:name="HTTP"/>

Now any request to "http://localhost:8080/my/service?wsdl" will cause your WSDL to be served.

Using CXF Proxy

While many times you can proxy web services without using CXF, there are several cases where you might want to use CXF proxies:

  • To work directly with the SOAP body, such as adding XML directly to it

  • To take advantage of the CXF web service standards support to use WS-Security or WS-Addressing

  • To enforce WS-Policy assertions

  • To easily service a WSDL associated with your service

  • To transform a SOAP body

See the Proxying Web Services with CXF for more details.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub