The Quick Start guide This tutorial gives an introduction to basic features and most common usage scenarios of the WSO2 ESB by walking you through two sample applications: one that performs message mediation by logging information about messages that have a specific header, and one that performs service mediation by performing logic on all messages that are destined for a specific endpoint.
Setting up the ESB
Anchor | ||||
---|---|---|---|---|
|
WSO2 ESB setup is relatively very easy. While a more detailed description of the installation steps are given in the Installation Guide, we have given below a summary to get you started fast.
...
6. The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."
Starting the Management Console
Anchor | ||||
---|---|---|---|---|
|
Now that the ESB is up and running, let's open its Management Console. WSO2 ESB starts with a default configuration, which is sufficient for the first sample scenario discussed here. The default configuration will be changed later when running the second sample scenario.
1. Set the log level of org.apache.synapse to DEBUG by editing the the <PRODUCT_HOME>/repository/
libconf/log4j.properties
file. This will cause the ESB to output debug messages for the actions it is performing. We can inspect these logs later using the Management Console.
...
3. On the ESB Sign-in screen, type admin for the username and admin for the password, and then click "Sign-in".
The Home page of the management console opens with various menu items listed on the left navigation panel. The ESB is now ready to execute the two sample mediation scenarios:
Message Mediation
Anchor | ||||
---|---|---|---|---|
|
In this sample, the ESB is used to filter and log the messages passing through it. Although this simple scenario only performs simple filtering and logging, it demonstrates the basics of message mediation. You can replace this simple functionality with any combination of advanced mediations such as transformation and content-based routing as well as bridging different communication protocols.
This sample will walk you through the following tasks:
Configure the Sample
Anchor | ||||
---|---|---|---|---|
|
1. In the ESB's Management Console, click "Monitor -> System Logs".
...
You have finished configuring the sample scenario and are ready to test and monitor the mediation.
Start the Server
Anchor | ||||
---|---|---|---|---|
|
We use a standalone Apache Axis2 Web services engine as the server, which is bundled with the WSO2 ESB distribution by default.
...
Code Block |
---|
user@host:~/wso2esb/samples/axis2Server$ ./axis2server.sh Using JAVA_HOME: /usr/java Using AXIS2 Repository : /home/user/wso2esb/samples/axis2Server/repository Using AXIS2 Configuration : /home/user/wso2esb/samples/axis2Server/repository/conf/axis2.xml 2007-11-08 18:00:54,283 [-] [main] INFO SimpleHTTPServer [SimpleAxisServer] Starting [SimpleAxisServer] Using the Axis2 Repository : /home/user/wso2esb/samples/axis2Server/repository [SimpleAxisServer] Using the Axis2 Configuration File : /home/user/wso2esb/samples/axis2Server/repository/conf/axis2.xml 2007-11-08 18:00:55,494 [-] [main] INFO HttpCoreNIOSender HTTPS Sender starting 2007-11-08 18:00:55,495 [-] [main] INFO HttpCoreNIOSender HTTP Sender starting 2007-11-08 18:00:55,798 [-] [main] INFO HttpCoreNIOListener HTTPS Listener starting on port : 9002 2007-11-08 18:00:55,804 [-] [main] INFO HttpCoreNIOListener HTTP Listener starting on port : 9000 2007-11-08 18:00:55,805 [-] [main] INFO SimpleHTTPServer [SimpleAxisServer] Started |
Run the Client
Anchor | ||||
---|---|---|---|---|
|
The final step is running the client.
...
Code Block |
---|
POST / HTTP/1.1 Content-Type: text/xml; charset=UTF-8 SOAPAction: "urn:getQuote" User-Agent: Axis2 Host: 127.0.0.1 Transfer-Encoding: chunked 218 <?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <wsa:To>http://localhost:9000/services/SimpleStockQuoteService</wsa:To> <wsa:MessageID>urn:uuid:D538B21E30B32BB8291177589283717</wsa:MessageID> <wsa:Action>urn:getQuote</wsa:Action> </soapenv:Header> <soapenv:Body> <m0:getQuote xmlns:m0="http://services.samples"> <m0:request> <m0:symbol>IBM</m0:symbol> </m0:request> </m0:getQuote> </soapenv:Body> </soapenv:Envelope>0 |
Monitor the Mediation
Anchor | ||||
---|---|---|---|---|
|
You have now seen how message mediation is performed by the ESB. Let's take a look at the various visual monitoring tools on the Monitor tab you can use to analyze the behavior of the ESB during the mediation.
...
You have completed the first sample, which illustrated how to configure and monitor the mediation of messages. The second sample walks you through the mediation of services .
Service Mediation Using Proxy Services
Anchor | ||||
---|---|---|---|---|
|
The ESB sends messages to services at designated endpoints. A proxy service acts as a virtual front end to a service, allowing you to mediate messages destined for that service. This service mediation can include adding WS-Security, exposing the message on a different transport, transforming the message, and more. It can mediate the messages before they are delivered to the actual endpoint, and it can mediate the response messages before they reach the client.
...
Let's explore a simple proxy service scenario that illustrates service mediation. This sample walks you through the following tasks:
Configure the Sample
Anchor | ||||
---|---|---|---|---|
|
1. If you have not already done so, set up the ESB and start the management console before proceeding.
2. Click "Main -> Proxy Service". There are several templates available for creating a proxy service.
...
You have finished configuring the sample scenario and are ready to test and monitor the mediation.
Start the Server
Anchor | ||||
---|---|---|---|---|
|
You already built and deployed the SimpleStockQuote service, so simply start the server by switching to the <PRODUCT_HOME>/samples/axis2Server directory and running one of the following commands:
- Linux / Unix:
./axis2server.sh
- Windows:
axis2server.bat
Run the Client
Anchor | ||||
---|---|---|---|---|
|
Now that the server is running, let's run the client and send a request to the service. Go to <PRODUCT_HOME>/samples/axis2Clients directory and type the following command:
Code Block |
---|
ant stockquote -Dtrpurl=http://localhost:8280/services/StockQuoteProxy -Dmode=quote -Dsymbol=IBM |
This command sends a stockquote request directly to the provided transport endpoint at: http://localhost:8280/services/StockQuoteProxy. The response from the server is displayed in the console as follows:
Code Block |
---|
Standard :: Stock price = $165.32687331383468 |
Monitor the Mediation
Anchor | ||||
---|---|---|---|---|
|
As with the previous message mediation sample, you can monitor log messages, statistics, and trace messages for the proxy service mediation. Let's look only at the statistics for the proxy service.
...