All docs This doc

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  1. If you have not already done so, see Getting Started with WSO2 ESB for details on installing and running WSO2 ESB.
  2. Log in to the management console at https://localhost:9443/carbon/ using admin for the username and password.
  3. Create an event sink in WSO2 ESB by navigating to Configure ->Event Sinks in the management console. Click on Add Event Sink.

    Fill in the details as in the following table:

    Receiver URLtcp://localhost:7612
    Authenticator URLssl://localhost:7712

    In WSO2 DAS the default thrift port and the authentication port are 7611 and 7711 respectively. Due to the port offset you configured the new ports are 7612 and 7712 as defined above.

  4. Create a REST API by navigating to Main ->APIs in the management console and click on Add API. Fill in the details as in the table below:

    API NameStockQuoteAPI

    Click on Switch to source view.

    In source view, add the following API configuration where the publish mediator uses the created event sink das_event_sink to publish to an event stream named stockquote_stream:

    Code Block
    <api xmlns="" name="StockQuoteAPI" context="/stockquote">
       <resource methods="GET" uri-template="/view/{symbol}">
               <payloadFactory media-type="xml">
                       <m0:getQuote xmlns:m0="http://services.samples">
                       <arg evaluator="xml" expression="get-property('uri.var.symbol')" />
               <header name="Action" value="urn:getQuote" />
                           <attribute xmlns:ns="http://org.apache.synapse/xsd" name="http_method" type="STRING" defaultValue="" expression="get-property('axis2', 'HTTP_METHOD')" />
                           <attribute xmlns:ns="http://org.apache.synapse/xsd" name="destination" type="STRING" defaultValue="" expression="get-property('To')" />
                           <attribute xmlns:ns="http://org.apache.synapse/xsd" name="date" type="STRING" defaultValue="" expression="get-property('SYSTEM_DATE')" />
                           <attribute xmlns:m0="http://services.samples" name="symbol" type="STRING" defaultValue="" expression="$body/m0:getQuote/m0:request/m0:symbol" />
                           <attribute name="request" type="STRING" defaultValue="" value="getSimpleQuote" />
                       <arbitrary />
                       <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap12"/>
               <send />
  5. Deploy the back-end service  SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.

  6. Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.


  7. Open a command line terminal and enter the following request to invoke the API you defined above: 

    curl -v http://localhost:8280/stockquote/view/WSO2

    You will see the response from the SimpleStockQuoteService.