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.
Deploying samples in WSO2 EI
To start WSO2 Enterprise Integrator with a selected service bus sample configuration
Open WSO2 Integration Studio.
Copy the sample configuration from the samples documentation into the source view of the WSO2 Integration Studio project files.
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.6.0/samples/axis2Server/repository/services/SimpleStockQuoteService.aar BUILD SUCCESSFUL Total time: 1 secondNext, you need to start the Axis2 server.
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.
To start the Axis2 server
Open a command prompt (or a shell in Linux) and go to the
<EI_HOME>/samples/axis2Serverdirectory.Execute one of the following commands
On Windows:
axis2server.batOn Linux/Solaris:
./axis2server.sh
This starts the Axis2 server with the HTTP transport listener on port 9000 and HTTPS on port 9002 respectively.
If you want to start multiple instances of the Axis2 server on different ports, run the following commands. Give unique names to each server.
./axis2server.sh -http 9001 -https 9005 -name MyServer1
./axis2server.sh -http 9002 -https 9006 -name MyServer2
./axis2server.sh -http 9003 -https 9007 -name MyServer3