<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="JMStoHTTPStockQuoteProxy" transports="jms">
<target>
<inSequence>
<property action="set" name="OUT_ONLY" value="true"/>
</inSequence>
<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>
<proxy name="OneWayProxy" transports="http">
<target>
<inSequence>
<log level="full"/>
</inSequence>
<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>
Executing the Client
This example invokes the one-way 'placeOrder' operation on the SimpleStockQuoteService
using the Axis2 ServiceClient.fireAndForget() API at the client. To test this,
run the sample client as follows and you will notice the one-way JMS message
flowing through Synapse into the sample Axis2 server instance over HTTP, and Axis2
acknowledging it with a HTTP 202 Accepted response.
ant stockquote -Dmode=placeorder -Dtrpurl="jms:/JMStoHTTPStockQuoteProxy?\
transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory\
&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory\
&java.naming.provider.url=tcp://localhost:61616\
&transport.jms.ContentTypeProperty=Content-Type&transport.jms.DestinationType=queue"
The second example shows how Synapse could be made to respond with a HTTP 202
Accepted response to a request received. The proxy service simply logs the message
received and acknowledges it. To try this out, run the sample client as follows.
ant stockquote -Dmode=placeorder -Dtrpurl=http://localhost:8280/services/OneWayProxy
On the Synapse console you could see the logged message, and if TCPMon was used
at the client, you would see the 202 Accepted response sent back to the client
from Synapse.
HTTP/1.1 202 Accepted
Content-Type: text/xml; charset=UTF-8
Host: 127.0.0.1
SOAPAction: "urn:placeOrder"
Date: Sun, 06 May 2007 17:20:19 GMT
Server: Synapse-HttpComponents-NIO
Transfer-Encoding: chunked
0