Versions Compared

Key

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

Objective: Introduction to ESB Proxy Services.

Code Block
languagehtml/xml
<definitions xmlns="http://ws.apache.org/ns/synapse">
    <proxy name="StockQuoteProxy">
        <target>
            <endpoint>
                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
            <outSequence>
                <send/>
            </outSequence>
        </target>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
    </proxy>
</definitions>

...

  • Start the Synapse configuration numbered 150 (: i.e. wso2esb-samples.sh -sn 150).
  • Start the Axis2 server and deploy the SimpleStockQuoteService if not already done.

...

  • quote - sends a quote request for a single stock as follows. The response contains the last sales price for the stock which would be displayed.
Code Block
languagehtml/xml
<m:getQuote xmlns:m="http://services.samples/xsd">
	<m:request>
		<m:symbol>IBM</m:symbol>
	</m:request>
</m:getQuote>
  • customquote - sends a quote request in a custom format. The ESB would transform this custom request into the standard stock quote request format and send it to the service. Upon receipt of the response it would be transformed again to a custom response format and returned to the client, which will then display the last sales price.
Code Block
languagehtml/xml
<m0:checkPriceRequest xmlns:m0="http://services.samples/xsd">
	<m0:Code>symbol</m0:Code>
</m0:checkPriceRequest>
  • fullquote - gets quote reports for the stock over a number of days (i.e. last 100 days of the year).
Code Block
languagehtml/xml
<m:getFullQuote xmlns:m="http://services.samples/xsd">
	<m:request>
		<m:symbol>IBM</m:symbol>
	</m:request>
</m:getFullQuote>

*placeorder - places an order for stocks using a one way request

Code Block
languagehtml/xml
<m:placeOrder xmlns:m="http://services.samples/xsd">
	<m:order>
		<m:price>3.141593E0</m:price>
		<m:quantity>4</m:quantity>
		<m:symbol>IBM</m:symbol>
	</m:order>
</m:placeOrder>
  • marketactivity - gets a market activity report for the day (i.e. quotes for multiple symbols)
Code Block
languagehtml/xml
<m:getMarketActivity xmlns:m="http://services.samples/xsd">
	<m:request>
		<m:symbol>IBM</m:symbol>
		...
		<m:symbol>MSFT</m:symbol>
	</m:request>
</m:getMarketActivity>

...