Sample 266: Switching from UDP to HTTP/S
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="StockQuoteProxy" transports="udp">
<target>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<inSequence>
<log level="full"/>
<property name="OUT_ONLY" value="true"/>
</inSequence>
</target>
<parameter name="transport.udp.port">9999</parameter>
<parameter name="transport.udp.contentType">text/xml</parameter>
<publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
</definitions>
Objective
Showcase the ability of Synapse to receive and process raw UDP messages
Executing the Client
This sample is similar to Sample 265. Only difference
is instead of the TCP transport we will be using the UDP transport to receive
messages.
Invoke the stockquote client using the following command. Note the UDP URL in the
command.
ant stockquote -Daddurl=udp://localhost:9999?contentType=text/xml -Dmode=placeorder
Since we have configured the content type as text/xml for the proxy service,
incoming messages will be processed as SOAP 1.1 messages.
When the proxy service forwards the message to the sample Axis2 server over HTTP,
sample server will print the following entry to confirm that the request has
been received.
Thu May 20 12:25:01 IST 2010 samples.services.SimpleStockQuoteService :: Accepted order #1 for : 17621 stocks of IBM at $ 73.48068475255796
Back to Catalog