This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Using the Sample Clients
Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation:
<PRODUCT_HOME>/
repository/samples/
directory that includes all Integration profile samples is changed to<EI_HOME>/
samples/service-bus/
.<PRODUCT_HOME>/
repository/samples/resources/
directory that includes all artifacts related to the Integration profile samples is changed to<EI_HOME>/
samples/service-bus/resources/
.
After setting up the samples, you can run them using sample clients. The sample clients can be executed from the <EI_HOME>/samples/axis2Client
directory by specifying the relevant ant
command.
You can execute ant
 from the <EI_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 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=../../samples/service-bus/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. WSO2 Enterprise Integrator 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>
Smart client mode
The 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, and the transport URL set to WSO2 Enterprise Integrator ensures that any mediation required takes place before the message is delivered to the ultimate receiver. For example:
ant stockquote -Daddurl=<addressingEPR> -Dtrpurl=<ei>
Gateway / dumb client mode
By specifying only a transport URL, the client operates in the dumb client
mode, where it sends the message to WSO2 Enterprise Integrator and depends on WSO2 Enterprise Integrator rules for proper mediation and routing of the message to the ultimate destination.Â
ant stockquote -Dtrpurl=<ei>
Proxy client mode
The client uses the prxurl
as an HTTP proxy to send the request. Therefore, by setting the prxurl
to WSO2 Enterprise Integrator, the client ensures that the message is sent to WSO2 Enterprise Integrator for mediation. The client can optionally set a WS-Addressing EPR if required.Â
ant stockquote -Dprxurl=<ei> [-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=./../../samples/service-bus/resources/mtom/asf-logo.gif]
Note
Be sure that you have ActiveMQ or any other JMS provider installed to run the JMS samples.
Optimize client
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 mtom
or 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=./../../samples/service-bus/resources/mtom/asf-logo.gif]
FIX client
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
JSON client
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]