Sample 56: Using a WSDL Endpoint as the Target Endpoint
Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation:
<PRODUCT_HOME>/
repository/samples/
directory that includes all Integration profile samples is changed to<EI_HOME>/
samples/service-bus/
.<PRODUCT_HOME>/
repository/samples/resources/
directory that includes all artifacts related to the Integration profile samples is changed to<EI_HOME>/
samples/service-bus/resources/
.
Introduction
This sample demonstrates how you can use a WSDL endpoint as the target endpoint. The configuration in this sample uses a WSDL endpoint inside the send mediator. This WSDL endpoint extracts the target endpoint reference from the WSDL document specified in the configuration. In this configuration the WSDL document is specified as a URI.
Prerequisites
For a list of prerequisites, see Prerequisites to Start the ESB Samples.
Building the sample
The XML configuration for this sample is as follows:Â
<definitions xmlns="http://ws.apache.org/ns/synapse"> <sequence name="main"> <in> <send> <!-- get epr from the given wsdl --> <endpoint> <wsdl uri="file:samples/service-bus/resources/proxy/sample_proxy_1.wsdl" service="SimpleStockQuoteService" port="SimpleStockQuoteServiceHttpSoap11Endpoint"/> </endpoint> </send> </in> <out> <send/> </out> </sequence> </definitions>
This configuration file  synapse_sample_56.xmlÂ
is available in the <ESB_HOME>/repository/samplesÂ
directory.
To build the sample
Start the ESB with the sample 56 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.
The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.
Deploy the back-end serviceÂ
SimpleStockQuoteService
. For instructions on deploying sample back-end services, see Deploying sample back-end services.
Executing the sample
The sample client used here is the Stock Quote Client, which can operate in several modes. For further details on this sample client and its operation modes, see Stock Quote Client.
To execute the sample client
Run the following command from theÂ
<ESB_HOME>/samples/axis2Client
 directory.ant stockquote -Dsymbol=IBM -Dmode=quote -Daddurl=http://localhost:8280
Analyzing the output
When the client is run, you will see the following output on the client console:
Standard :: Stock price = $95.26454380258552
According to  synapse_sample_56.xmlÂ
the WSDL endpoint inside the send mediator extracts the EPR from the WSDL document. Since WSDL documents can have many services and many ports inside each service, the service and port of the required endpoint has to be specified in the configuration via the service
 and port
 attributes respectively. When it comes to address endpoints, the QoS parameters for the endpoint can be specified in the configuration. An excerpt taken from sample_proxy_1.wsdl
, which is the WSDL document used in  synapse_sample_56.xml
  is given below.
<wsdl:service name="SimpleStockQuoteService"> <wsdl:port name="SimpleStockQuoteServiceHttpSoap11Endpoint" binding="ns:SimpleStockQuoteServiceSoap11Binding"> <soap:address location="http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap11Endpoint"/> </wsdl:port> <wsdl:port name="SimpleStockQuoteServiceHttpSoap12Endpoint" binding="ns:SimpleStockQuoteServiceSoap12Binding"> <soap12:address location="http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap12Endpoint"/> </wsdl:port> </wsdl:service>
According to the above WSDL, the service and port specified in the configuration refers to the endpoint address http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap11Endpoint