## Apache Synapse

## Sample 150: Introduction to Proxy Services

<definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="StockQuoteProxy"> <target> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> <outSequence> <send/> </outSequence> </target> <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/> </proxy> </definitions>

### Objective

Introduce the concept of proxy services in Synapse

### Pre-requisites

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

### Executing the Client

Execute the stock quote client as follows and invoke the proxy service:

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

The 'inSequence' or 'endpoint' or both of these would decide how the message would be handled after the proxy service receives the message. In the above example, the request received is forwarded to the sample service hosted on Axis2. The 'outSequence' defines how the response is handled before it is sent back to the client. By default, a proxy service is exposed over all transportss configured for Synapse, unless these are specifically mentioned through the 'transports' attribute.

You can also view the WSDL of the proxy service by launching a web browser and navigating to the following URL:

http://localhost:8280/services/StockQuoteProxy?wsdl

Back to Catalog