This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Sample 151: Custom Sequences and Endpoints with Proxy Services
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/
.
Objective: Using custom sequences and endpoints for message mediation with Proxy Services.
<definitions xmlns="http://ws.apache.org/ns/synapse"> <sequence name="proxy_1"> <send> <endpoint><address uri="http://localhost:9000/services/SimpleStockQuoteService"/></endpoint> </send> </sequence> <sequence name="out"> <send/> </sequence> <endpoint name="proxy_2_endpoint"> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> <localEntry key="proxy_wsdl" src="file:samples/service-bus/resources/proxy/sample_proxy_1.wsdl"/> <proxy name="StockQuoteProxy1"> <publishWSDL key="proxy_wsdl"/> <target inSequence="proxy_1" outSequence="out"/> </proxy> <proxy name="StockQuoteProxy2"> <publishWSDL key="proxy_wsdl"/> <target endpoint="proxy_2_endpoint" outSequence="out"/> </proxy> </definitions>
Prerequisites
- Start the Synapse configuration numbered 151: i.e.
wso2ei-samples.sh -sn 151
- Start the Axis2 server and deploy the
SimpleStockQuoteService
if not already done.
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 that are received to the endpoint named "proxy_2_endpoint" without any mediation.
You could send a stock quote request to each of these Proxy Services and receive the reply generated by the actual service hosted on the Axis2 instance.
ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy1 ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy2