Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation :
repository/samples/directory that includes all Integration profile samples is changed to
repository/samples/resources/directory that includes all artifacts related to the Integration profile samples is changed to
This sample demonstrates how to perform a simple database read operation database using the DBLookup mediator.
In this sample, when a message arrives at the DBLookup mediator, it opens a connection to the database and executes the SQL query. The SQL query uses the
? character for attributes that are specified at runtime, and the parameters define how to calculate the value of those attributes.Here, the DBLookup mediator is used to extract the id of the company from the company database using the symbol that is evaluated using an XPath against the SOAP envelope, and the id base switching is done by a Switch mediator.
- Set up the Apache Derby database. For information on how to set up the Derby database, see Setting up Derby.
- For a list of general prerequisites, see Prerequisites to Start the ESB Samples.
Building the sample
The XML configuration for this sample is as follows:
This configuration file
synapse_sample_360.xml is available in the
To build the sample
Start the ESB with the sample 360 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.
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."
Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.
Deploy the back-end service SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.
Executing the sample
The sample client used here is the Stock Quote Client, which can operate in several modes. For further details on this sample client and its operation modes, see Stock Quote Client.
To execute the sample client
Run each of the following commands from the
First, run the following command, specifying IBM as the stock symbol:
Then, run the following command, specifying SUN as the stock symbol.
Next, run the following command, specifying MSFT as the stock symbol.
Analyzing the output
When you run the command that requests the IBM stock quote, you will see the following output on the ESB console:
When you run the command that requests the SUN stock quote, you will see the following output on the ESB console:
When you run the command that requests the MSFT stock quote, you will see the following output on the ESB console:
If you run a command for any other symbol, you will see that the ESB console displays the following:
You will also observe that the client gets a response with the following message.