After setting up the samples, you can use the sample clients to run them. The sample clients can be executed from the
<ESB_HOME>/samples/axis2Client directory through the provided Ant script. Simply executing
ant displays the available clients and some of the sample options used to configure them.
Following is more information about each of the sample clients. For details on using a sample client to run a specific sample, go to Samples and click the link for the sample you want to run.
Stock Quote client
This is a simple SOAP client that could send stock quote requests, and receive and display the last sale price for a stock symbol.
ant stockquote [\-Dsymbol=IBM|MSFT|SUN|..] [\-Dmode=quote |customquote|fullquote | placeorder | marketactivity] [-Daddurl=http://localhost:9000/services/SimpleStockQuoteService|\||] [-Dtrpurl=http://localhost:8280/|\||] [-Dprxurl=http://localhost:8280/|\||] [-Dpolicy=../../repository/samples/resources/policy/policy_1.xml|\||]
The client is able to operate in the following modes, and send the payloads listed below as SOAP messages:
- 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.
<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.
<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, 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>
Smart client mode
addurl property sets the WS-Addressing EPR, and the
trpurl sets a transport URL for a message. Thus by specifying both properties, the client can operate in the
smart client mode, where the addressing EPR could specify the ultimate receiver, while the transport URL set to the ESB ensures that any necessary mediation 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. For example:
ant stockquote -Dtrpurl=<esb>
Proxy client mode
In this mode, the client uses the
prxurl as an HTTP proxy to send the request. Thus by setting the
prxurl to the ESB, the client could ensure that the message would reach the ESB for mediation. The client could optionally set a WS-Addressing EPR if required. For example:
ant stockquote -Dprxurl=<esb> [-Daddurl=<addressingEPR>]
Specifying a policy
By specifying a WS-Policy using the
policy property, QoS aspects such as WS-Security could be enforced on the request. The policy specifies details such as timestamps, signatures, and encryption.
Generic JMS client
The JMS client is able to send plain text, plain binary content, or POX content by directly publishing a JMS message to the specified destination. The JMS destination name should be specified with the
jms_dest property. The
jms_type property could specify 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 would 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. For example:
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 the local machine.
MTOM / SwA client
The MTOM / SwA client 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 specify
swa respectively for the above mentioned optimizations. 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. For example:
ant optimizeclient -Dopt_mode=[mtom | swa]