After setting up the ESB samples, you can run them using the sample clients. The sample clients can be executed from the
<ESB_HOME>/samples/axis2Client directory by specifying the relevant
You can execute
ant from the
<ESB_HOME>/samples/axis2Client directory, in order to view the available sample clients and some of the sample options used to configure them.
This section describes each of the following sample clients in detail.
Stock Quote client
This is a simple SOAP client that can create and send stock quote requests, as well as receive and display the last sale price for a stock symbol.
The required stock symbol and operation can be specified as follows:
ant stockquote [-Dsymbol=IBM|MSFT|SUN|..] [-Dmode=quote | customquote | fullquote | placeorder | marketactivity] [-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService] [-Dtrpurl=http://localhost:8280] [-Dprxurl=http://localhost:8280] [-Drest=true] [-Dwsrm=true] [-Dpolicy=../../repository/samples/resources/policy/policy_1.xml]
The stock quote client is able to operate in the smart client mode, gateway/dumb client mode as well as proxy client mode, and can send the payloads listed below as SOAP messages:
- quote - Sends a quote request for a single stock as follows. The response contains the last sale price for the stock which would be displayed.
<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 would be returned to the client, which will then display the last sales price.
<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 (for example, for the last 100 days of the year).
<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.
<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 (for example, quotes for multiple symbols).
<m:getMarketActivity xmlns:m="http://services.samples/xsd"> <m:request> <m:symbol>IBM</m:symbol> ... <m:symbol>MSFT</m:symbol> </m:request> </m:getMarketActivity>
You can apply a WS-Policy to the request using the
policy property in order to enforce QoS aspects such as WS-Security on the request. The policy specifies details such as timestamps, signatures, and encryption.
Smart client mode
addurl property sets the WS-Addressing EPR, and the
trpurl sets a transport URL for a message. Therefore, by specifying both properties, the client can operate in the
smart client mode, where the addressing EPR can specify the ultimate receiver, while the transport URL set to the ESB ensures that any mediation required takes place before the message is delivered to the ultimate receiver. For example:
ant stockquote -Daddurl=<addressingEPR> -Dtrpurl=<esb>
Gateway / dumb client mode
By specifying only a transport URL, the client operates in the
dumb client mode, where it sends the message to the ESB and depends on the ESB rules for proper mediation and routing of the message to the ultimate destination.
ant stockquote -Dtrpurl=<esb>
Proxy client mode
The client uses the
prxurl as an HTTP proxy to send the request. Therefore, by setting the
prxurl to the ESB, the client can ensure that the message would reach the ESB for mediation. The client can optionally set a WS-Addressing EPR if required.
ant stockquote -Dprxurl=<esb> [-Daddurl=<addressingEPR>]
Generic JMS client
This is a client that can send plain text, plain binary content, or POX content by directly publishing a JMS message to a specified destination. The JMS destination name should be specified with the
jms_dest property. The
jms_type property can be text, binary or pox to specify the type of message payload.
The plain text payload for a text message can be specified through the
payload property. For binary messages, the
payload property will contain the path to the binary file. For POX messages, the
payload property will hold a stock symbol name to be used within the POX request for stock order placement request.
ant jmsclient [-Djms_type=text] [-Djms_dest=dynamicQueues/JMSTextProxy][-Djms_payload="24.34 100 IBM"] ant jmsclient [-Djms_type=pox] [-Djms_dest=dynamicQueues/JMSPoxProxy] [-Djms_payload=MSFT] ant jmsclient [-Djms_type=binary] [-Djms_dest=dynamicQueues/JMSFileUploadProxy] [-Djms_payload=./../../repository/samples/resources/mtom/asf-logo.gif]
The JMS client assumes the existence of a default ActiveMQ (5.2.0) installation on your local machine in order to run some of the samples.
This is a client that can send a binary image file as a MTOM or SwA optimized message, and receive the same file again through the response and save it as a temporary file. The
opt_mode can be
swa respectively for the optimization. Optionally, the path to a custom file can be specified through the
opt_file property, and the destination address can be changed through the
opt_url property if required.
ant optimizeclient [-Dopt_mode=mtom | swa] [-Dopt_url=http://localhost:8280/soap/MTOMSwASampleService] [-Dopt_file=./../../repository/samples/resources/mtom/asf-logo.gif]
This is a client that can post a FIX message of type Order-Single embedded into a SOAP message.
ant fixclient -Dsymbol=IBM -Dqty=5 -Dmode=buy -Daddurl=http://localhost:8280/soap/FIXProxy
This is a client that can send get-quote requests using the JSON content interchange format over HTTP.
ant jsonclient [-Daddurl=http://localhost:8280/services/JSONProxy] [-Dsymbol=DELL]