All docs This doc
Skip to end of metadata
Go to start of metadata

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 the use of XQuery mediator to import external XML documents to the XQuery engine

<definitions xmlns="http://ws.apache.org/ns/synapse">

    <!-- the SimpleURLRegistry allows access to  URL based registry (e.g. file:/// or http://) -->
    <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
        <!-- the root property of the simple URL registry helps resolve a resource URL as root + key -->
        <parameter name="root">file:repository/samples/resources/</parameter>
        <!-- all resources loaded from the URL registry would be cached for this number of milli seconds -->
        <parameter name="cachableDuration">15000</parameter>
    </registry>

    <proxy name="StockQuoteProxy">
        <target>
            <inSequence>
                <send>
                    <endpoint>
                        <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
                    </endpoint>
                </send>
            </inSequence>
            <outSequence>
                <out>
                    <xquery key="xquery/xquery_commisson.xq">
                        <variable name="payload" type="ELEMENT"></variable>
                            <variable name="commission" type="ELEMENT" key="misc/commission.xml"></variable>
                    </xquery>
                    <send/>
                </out>
            </outSequence>
        </target>
        <publishWSDL uri="file:samples/service-bus/resources/proxy/sample_proxy_1.wsdl"/>
    </proxy>
</definitions>

Prerequisites:

  • Deploy the SimpleStockQuoteService in sample Axis2 server and start it on port 9000.
  • Create the above configuration and deploy it in the WSO2 EI profile, see Working with WSO2 Integration Studio.

In this sample, data from commission.xml document is used inside XQUERY document. The stock quote price from the response and commission from the commission.xml document will be added and given as a new price .

Invoke the client as follows.

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