WSDL Mediation (Proxy Services) on Apache Synapse

Archived Content
This article is provided for historical perspective only, and may not reflect current conditions. Please refer to relevant product page for more up-to-date product information and resources.
  • By Saminda Abeyruwan
  • 26 Jun, 2006

Let's look at the Synapse rule language for proxies. Table 1 lists xml namespace that is used in this article.

Prefix | Namespace |
syn | |
Table 1

In synapse.xml, one could find the following structure,

<syn:synapse xmlns:syn="">


Proxy services are defined in an element called <proxies/>. All proxies are defined by <proxy/> element and its sub elements. <proxy/> is a core part Synapse, it's belong to the [] namespace. Let's look at the structure of the <proxy/> element.

<syn:proxy name=”string” type=”wsdl | jms | rest” [description=”string”]>
<syn:endpoint protocols=”http | https | jms | {custom protocol} | all” [uri=”uri”]/>
<syn:target sequence=”name” | endpoint=”name”/>?
<syn:wsdl url=”url”/>
<syn:schema url=”url”/>?
<syn:policy url=”url”/>?

The following describes the Element Information Items defined in the schema outlined above, /syn:proxy A proxy service expression. /syn:proxy/syn:endpoint The endpoint where the proxy service should be available on. Thus where the inbound message should go. /syn:proxy/syn:target This is where outbound message should flow through. /syn:proxy/syn:wsdl Location of the wsdl where the Axis2 service should be built. /syn:proxy/syn:policy Policy elements that the Axis2 service should be merged with. The following describes the Attribute Information Items defined in the schema outlined above, /syn:proxy/@name Name of the proxy service. The @name is used to build the actual Axis2 service and @name used to hold this proxy service in the SynapseConfiguration. /syn:proxy/@type Type on which Axis2 service should be built on. This has three types

  1. wsdl
  2. jms
  3. rest

Current code base handles only wsdl type which is the default. /syn:proxy/syn:endpoint/@protocols protocols in which the proxy service is exposed. This could be any protocol such as http, https or any other protocol which is custom or standard. The user can specify multiple protocols by separating them with a comma “ ,” (ex: <endpoint protocols=”https,jms”/>). User can specify “all” to listen on all protocols available. Default is “all”. /syn:proxy/syn:target/@sequence or /syn:proxy/syn:target/@endpoint This is how outbound messages flow. If @sequence is specified, the outbound message will mediate through a group of mediators that is referenced by the @sequence. If @endpoint is specified, the outbound message will be directed to this endpoint. No mediation will be done at this level. If @sequence or @endpoint is not specified, the message will be passed to the default endpoint based on the value in MessageContex#getTo(); /syn:proxy/syn:wsdl/@url Location of the wsdl. This will build the Axis2 service based on the wsdl specified. Current codebase handles only version 1.0 of WSDL. Extensions will be available with Axis2 advances to support WSDL version of 2.0. /syn:proxy/syn:schema/@url and /syn:proxy/syn:policy/@url These are extensions that will allow on policy and schema manipulation. Examples: Following samples are based on web services exposed on This web service allows you to get a stock quote delayed by 20 minutes. Precondition: Save the in your local machine file system. As I'm running on Linux, assume I have saved the prior wsdl in /tmp/wsdl/Sample_Stock_Quote_Invesbot.wsdl. Assume user has the basic knowledge on Synapse rule language. Assume the following synapse.xml.

<synapse xmlns="">  
<sequence name="stockquote">
<log level="full"/>
<header name="To" value=""/>

<endpoint name="invesbot" address=""/>

Lets write the proxies. In this sample, we will use three proxy services,

  1. InvesbotDefaultProxy: There will be no mediation at all, the message will be passed through to the endpoint based on the value of MessageContext#getTo().
  2. InvesbotForwardProxy: The message will be forwarded to the endpoint based on the value of <target/> @endpoint.
  3. InvesbotSequenceProxy: The message will allow to pass through a set of mediators that the proxy service has been referenced by @sequence.

Now we have the following proxy services,


<proxy name="InvesbotDefaultProxy" type="wsdl" >
<endpoint protocol="http" />
<wsdl url="file:/tmp/wsdl/Sample_Stock_Quote_Invesbot.wsdl"/>

<proxy name="InvesbotForwardProxy" type="wsdl" >
<endpoint protocol="http"/>
<target endpoint="invesbot"/>
<wsdl url="file:/tmp/wsdl/Sample_Stock_Quote_Invesbot.wsdl"/>

<proxy name="InvesbotSequenceProxy" type="wsdl">
<endpoint protocol="http"/>
<target sequence="stockquote"/>
<wsdl url="file:/tmp/wsdl/Sample_Stock_Quote_Invesbot.wsdl"/>

When you run Synapse with the prior rule configuration, use can observe the ?wsdl, ?xsd, and ?policy. So user can simply create stubs using ?wsdl and call to the proxy services.