## Apache Synapse

## Sample 56: WSDL Endpoint

<definitions xmlns="http://ws.apache.org/ns/synapse"> <sequence name="main"> <in> <send> <!-- get epr from the given wsdl --> <endpoint> <wsdl uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl" service="SimpleStockQuoteService" port="SimpleStockQuoteServiceHttpSoap11Endpoint"/> </endpoint> </send> </in> <out> <send/> </out> </sequence> </definitions>

### Objective

Showcase the ability of Synapse to use a WSDL as the target endpoint

### Pre-requisites

- Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
- Start Synapse using the configuration numbered 56 (repository/conf/sample/synapse_sample_56.xml)
  Unix/Linux: sh synapse.sh -sample 56
  Windows: synapse.bat -sample 56

### Executing the Client

This sample uses a WSDL endpoint inside the send mediator. WSDL endpoints can extract endpoint's address from the given WSDL. As WSDL documents can have many services and many ports inside each service, the service and port of the required endpoint has to be specified. As with address endpoints, QoS parameters for the endpoint can be specified in-line in the configuration. An excerpt taken from the sample_proxy_1.wsdl containing the specified service and port is listed 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>

Specified service and port refers to the endpoint address 'http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap11Endpoint' according to the above WSDL. Now run the client using the following command.

ant stockquote -Daddurl=http://localhost:8280/

Client will print the quote price for IBM received from the server running on port 9000.

Standard :: Stock price = $95.26454380258552

Back to Catalog