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 267: Switching from UDP to HTTP/S

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: Demonstrate receiving SOAP messages over UDP and forwarding them over HTTP

<definitions xmlns="http://ws.apache.org/ns/synapse"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://ws.apache.org/ns/synapse http://synapse.apache.org/ns/2010/04/configuration/synapse_config.xsd">

    <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>

Prerequisites:

This sample is similar to Sample 266. 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 TCP 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. The sample Axis2 server console will print a message indicating that it has received the request:

Thu May 20 12:25:01 IST 2010 samples.services.SimpleStockQuoteService :: Accepted order #1 for : 17621 stocks of IBM at $ 73.48068475255796