This documentation is for WSO2 Enterprise Service Bus version 4.7.0 . View documentation for the latest release.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Objective: Demonstrate the use of XQuery mediator to import external XML documents to the XQuery engine

Code Block
<definitions xmlns="">

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

    <proxy name="StockQuoteProxy">
                        <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
                    <xquery key="xquery/xquery_commisson.xq">
                        <variable name="payload" type="ELEMENT"></variable>
                            <variable name="commission" type="ELEMENT" key="misc/commission.xml"></variable>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>


  • Deploy the SimpleStockQuoteService in sample Axis2 server and start it on port 9000.
  • Start ESB with the sample configuration 391 (i.e. wso2esb-samples -sn 391).

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.

Code Block
ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy