## Apache Synapse

## Sample 151: Custom Sequences and Endpoints with Proxy Services

<definitions xmlns="http://ws.apache.org/ns/synapse"> <localEntry key="proxy_wsdl" src="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/> <endpoint name="proxy_2_endpoint"> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> <sequence name="proxy_1"> <send> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> </send> </sequence> <sequence name="out"> <send/> </sequence> <proxy name="StockQuoteProxy1"> <target inSequence="proxy_1" outSequence="out"/> <publishWSDL key="proxy_wsdl"/> </proxy> <proxy name="StockQuoteProxy2"> <target endpoint="proxy_2_endpoint" outSequence="out"/> <publishWSDL key="proxy_wsdl"/> </proxy> </definitions>

### Objective

Demonstrate how to use predefined endpoints and sequences in a proxy service

### Pre-requisites

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

### Executing the Client

This configuration creates two proxy services. The first proxy service 'StockQuoteProxy1' uses the sequence named 'proxy_1' to process incoming messages and the sequence named 'out' to process outgoing responses. The second proxy service, 'StockQuoteProxy2' is set to directly forward messages to the endpoint named 'proxy_2_endpoint' without any mediation.

You can send a stock quote request to each of these proxy services and receive the reply generated by the actual service hosted on the Axis2 server instance.

ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy1
ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy2

Back to Catalog