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/.
Setting Up the ESB Samples
This section describes the prerequisites and instructions on how to start WSO2 Enterprise Integrator with the service bus sample configurations, how to start the Axis2 server and deploy the sample back-end services to the Axis2 server, as well as how to set up any listeners and transports that are required by the service bus samples.
Once you have set up the service bus samples, you can run them using the sample clients.
Prerequisites
Ensure that you have the following in your environment:
Oracle JDK 1.7.*/1.8.*.
JAVA_HOME environment variable is set to <JDK_HOME>.
Apache Ant 1.7.0 or above.
ActiveMQ or any other JMS provider to run the JMS samples.
Open a command prompt (or a shell in Linux) and go to the
bindirectory of the distribution. Then run theantcommand to build thebuild.xmlfile.Run WSO2 Enterprise Integrator in the DEBUG mode. To switch from the default INFO log messages to DEBUG log messages, edit the
<EI_HOME>/conf/log4j.propertiesfile and change the linelog4j.category.org.apache.synapse=INFOtolog4j.category.org.apache.synapse=DEBUG.
Understanding the service bus samples
The service bus samples use several sample clients, configurations and sample back-end services in order to explain different use cases. The diagram below depicts the interaction between the sample clients, WSO2 Enterprise Integrator and the services at a high level. The clients are able to send SOAP/REST or POX messages over transports such as HTTP/HTTPS or JMS with WS-Addressing, or WS-Security. They can send binary optimized content using MTOM, SwA, binary or plain text JMS messages. After mediation through WSO2 Enterprise Integrator, the requests are passed over to sample services.
Starting a service bus sample configuration
To start WSO2 Enterprise Integrator with a selected service bus sample configuration
Open a command prompt (or a shell in Linux) and go to the
<EI_HOME>\bindirectory.Execute one of the following commands, where <n> denotes the number assigned to the sample.
On Windows:
wso2ei-samples.bat -sn <n>On Linux/Solaris:
./wso2ei-samples.sh -sn <n>
For example, to start the WSO2 Enterprise Integrator with the Sample 0 configuration on Linux/Solaris, run the following command:
./wso2ei-samples.sh -sn 0The <EI_HOME>/samples/service-bus directory contains all the configuration files of the samples as synapse_sample_<n>.xml files. Here again, <n> denotes the sample number of the service bus sample you are running.
For example, the configuration file for service bus Sample 0 is synapse_sample_0.xml.
Deploying sample back-end services
The sample back-end services come with a pre-configured Axis2 server. These sample services demonstrate in-only and in-out SOAP/REST or POX messaging over HTTP/HTTPS and JMS transports, using WS-Addressing and WS-Security. The samples handle binary content using MTOM and SwA.
Each back-end sample service can be found in a separate folder in the <EI_HOME>/samples/axis2Server/src directory. You need to compile, build and deploy each back-end service to the Axis2 server.
To build and deploy a back-end service
Open a command prompt (or a shell in Linux) and go to the required sample folder in the
<EI_HOME>/samples/axis2Server/srcdirectory.Run
antfrom the selected sample directory.
For example, to build and deploy SimpleStockQuoteService, run theantcommand from the<EI_HOME>/samples/axis2Server/src/SimpleStockQuoteServicedirectory, as follows:user@host:/tmp/wso2ei-6.1.1/samples/axis2Server/src/SimpleStockQuoteService$ ant Buildfile: build.xml ... build-service: .... [jar] Building jar: /tmp/wso2ei-6.0.0/samples/axis2Server/repository/services/SimpleStockQuoteService.aar BUILD SUCCESSFUL Total time: 1 second
Sample back-end services explained
SimpleStockQuoteServiceThis service has four operations:
getQuote(in-out) - Generates a sample stock quote for a given symbol.getFullQuote(in-out) - Generates a history of stock quotes for a symbol for a number of days.getMarketActivity(in-out) - Returns stock quotes for a list of given symbols.placeOrder(in-only) - Accepts a one way message for an order.
SecureStockQuoteServiceThis service is a clone of the
SimpleStockQuoteService, but has WS-Security enabled as well as an attached security policy for signing and encrypting messages.MTOMSwASampleServiceThis service has three operations:
uploadFileUsingMTOM(in-out) - Accepts a binary image from the SOAP request as MTOM, and returns this image back again as the response.uploadFileUsingSwA(in-out) - Accepts a binary image from the SOAP request as SwA, and returns this image back again as the response.oneWayUploadUsingMTOM(in-only) - Saves the request message to the disk.
This service also demonstrates the use of MTOM and SwA.
Starting the Axis2 server
For the samples, a standalone Apache Axis2 Web services engine is used as the back-end server, which is bundled with the WSO2 Enterprise Integrator distribution by default.
Once each back-end service is deployed to the Axis2 server, you need to start the Axis2 server before executing the sample client.