Tuesday, January 26, 2010

Quick guide to installing WSO2 ESB 2.1.x on IBM Websphere

This is a quick guide on how to install Carbon based WSO2 ESB on IBM WebsphereV6.1

Step 1 - Adding the keystore

Create a new profile through the 'Profile Management Tool' and then start the IBM Websphere server. Follow the steps given under 'Adding the keystore' of http://wso2.org/library/2735 and add the wso2carbon.jks keystore

Next, go to SSL certificate and key management > SSL configurations and click on 'NodeDefaultSSLSettings'. Select created keystore (E.g.:- wso2carbon) from the combo boxes 'Trust store name' and 'Keystore Name' and then click on the button 'Get certificate aliases'.
Click on 'Apply' and then save the changes done.

Step 2 - Preparing WSO2 ESB

Download the WSO2 ESB distribution and extract to a specific location. (E.g.:- C:\esb\wso2esb-2.1.2).
From this folder copy the folders,

- conf
- database
- resources
- repository


to a separate folder. (E.g.:- C:\esb\esb_repo). We will refer to this as the CARBON_HOME from this point onwards.

For Carbon 3.0.x family, you need to copy only the two folders resources and repository.

Step 3 - Changing necessary files of the WSO2 ESB distribution

a) Open the carbon.xml file which is in the CARBON_HOME\conf folder and specify the correct WebContentRoot

E.g.:- /esb
Also change the ServerURL value in the same file as below.

https://localhost:9444/esb/services/
b) Next open the axis2.xml which is located inside the CARBON_HOME\conf and specify the correct paths for the two .jks files wso2carbon.jks and client-truststore.jks specified in the axis2.xml

c) Then you need to specify the absolute paths of the WSO2CARBON_DB of the two files registry.xml and user-mgt.xml

E.g.:- Change
jdbc:derby:database/WSO2CARBON_DB;create=true
to
jdbc:derby:C:\esb\esb_repo\WSO2CARBON_DB;create=true


f) Next you will have to specify the absolute path of the synapse.xml which is in the axis2.xml file located at CARBON_HOME/conf

E.g.:-
Change
conf/synapse.xml
to
C:\esb\esb_repo\conf\synapse.xml


Step 4 - Deploying the esb.war

a) Go to the webapps\ROOT folder of the WSO2 ESB which you extracted and create a war file using the command

jar -cvf esb.war *

b) Then as specified under 'Adding WSO2 WSAS to IBM WebSphere Application Server' of http://wso2.org/library/2735, install the war file.


Step 5 - Starting the IBM Websphere server

Now stop the startServer.bat and set the CARBON_HOME to the folder which you copied the folders conf, database, resources etc.

Next start the server and access the management console using
https://localhost:9444/esb/carbon

Wednesday, February 18, 2009

Deploying WSO2 ESB 2.0 on Apache Tomcat

As you all know WSO2 ESB can be deployed on different application servers such as IBM WebSphere, BEA WebLogic Server, JBoss and Apache Tomcat. I have written a blog previously on how one can deploy WSO2 ESB on Apache Tomcat. Unfortunately this does not work with the new Carbon based WSO2 ESB. Therefore for anyone who is interested on deploying WSO2 ESB on Apache Tomcat the following guide will be useful.

Step 1 - Downloading and installing Apache Tomcat

You can download the latest version of Apache Tomcat from here (I will be using Apache Tomcat 5.5.20 to demonstrate this scenario).
Extract the downloaded distribution to a specific location and define the environment variables properly. (Assume you extracted the downloaded Tomcat into the folder C:\apache-tomcat-5.5.20)

E.g.: -
CATALINA_HOME=C:\apache-tomcat-5.5.20

Next you will need to enable HTTPS on Apache Tomcat since WSO2 ESB runs over HTTPS. To do this, access the server.xml file located at %CATALINA_HOME%/conf and uncomment the following.

<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"/>

Then you will need to provide the keystore file location along with it's password as below.

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="C:\Carbon\ESB\tomcat_repo\resources\security\wso2carbon.jks"
keystorePass="wso2carbon"/>


Step 2 - Downloading and installing WSO2 ESB

Download the latest WSO2 ESB distribution from here and extract to a specific location. (E.g.:- C:\Carbon\ESB\tomcat\wso2esb-SNAPSHOT). From this folder copy the folders,

- conf
- database
- resources
- repository

to a separate folder. (E.g.:- C:\Carbon\ESB\tomcat\esb_home)

Step 3 - Setting environmental variables

You will have to set an environment variable with the name CARBON_HOME pointing it to the directory which you copied the above files to.
E.g.:-
CARBON_HOME=C:\Carbon\ESB\tomcat\esb_home

Step 4 - Copying required files to Apache Tomcat

Now create a folder inside the webapps folder of Tomcat.
E.g.:-
C:\apache-tomcat-5.5.20\webapps\esb

Next, you need to copy the WEB-INF folder, which is in the folder which you extracted the downloaded ESB distribution. Then copy it into the esb folder which you created above.
E.g.:-
Copy
C:\Carbon\ESB\tomcat\wso2esb-SNAPSHOT\webapps\ROOT\WEB-INF
to
C:\WSO2\Installations\apache-tomcat-5.5.20\webapps\esb


Step 5 - Changing necessary files of the WSO2 ESB distribution

a) Open the carbon.xml file which is in the CARBON_HOME\conf folder and specify the following URL as the ServerURL
E.g.:-
https://localhost:8443/esb/services/

b) Next open the axis2.xml which is located inside the CARBON_HOME\conf and change the http port from 8280 to 8080 (the default http port of Tomcat) and the https port from 8243 to 8443.
Note that you do not have to do this in the Carbon based WSO2 ESB distribution. Just leave the ports as they are.

c) In addition to the above, you need to specify the correct paths for the two .jks files wso2carbon.jks and client-truststore.jks specified in the axis2.xml and also the wso2carbon.jks file specified in the carbon.xml file.

d) Then you also have to change the contextRoot parameter value to /esb of the axis2.xml file
Instead of the above, in the Carbon based ESB you need to change the WebContextRoot parameter in the carbon.xml

e) Then you need to specify the absolute paths of the WSO2CARBON_DB of the two files registry.xml and user-mgt.xml
E.g.:- Change
jdbc:derby:database/WSO2CARBON_DB;create=true
to
jdbc:derby:C:\Carbon\ESB\tomcat\esb_home\WSO2CARBON_DB;create=true


f) Next you will have to specify the absolute path of the synapse.xml which is in the axis2.xml file located at CARBON_HOME\conf

E.g.:-
Change
conf/synapse.xml
to
C:\Carbon\ESB\tomcat\esb_home\conf\synapse.xml

Step 6 - Starting the Apache Tomcat Server

Now you can start the Apache Tomcat server by giving the following command.
catalina.bat run

Step 7 - Login to the WSO2 ESB Administration Console

Now you should be able to login to the WSO2 ESB Administration Console as, https://localhost:8443/esb/carbon

Monday, November 24, 2008

How to relocate an SVN location

To switch the svn location which you were working, to a new location you can use the following command

svn switch --relocate [old_location] [new_location]

Monday, November 10, 2008

How to invoke a Proxy Service created on WSO2 ESB deployed on IBM Websphere

When you deploy WSO2 ESB on IBM Webphere you will not be able to invoke the created Proxy services or sequences the general way you do it. This requires a new parameter to be given and the ports too should be correctly specified.

Assume that the web context root given when deploying WSO2 ESB is 'esb'. Also if the specified HTTP port of IBM Websphere is 9080, you can invoke a Proxy service which you have created on WSO2 ESB as follows.


ant stockquote -Dtrpurl=http://localhost:<HTTPS_port_of_WAS>/
<web_context_root>/soap/<Proxy_name>


E.g.:- ant stockquote -Dtrpurl=http://localhost:9080/esb/soap/SimpleProxy

Tuesday, November 4, 2008

Performance testing on a Derby database - JMeter to the rescue

One of my friends had a requirement of doing a performance test on a Derby database and she proposed that it would be easier if we do it through Apache JMeter. This was quite new to me and had to do a lot of Google searches but at the end was able to get it working so thought of sharing it with you all. I assume that you all are familiar with Apache JMeter. I will simply explain the steps along with some screen shots.

Step 1

Download and install Apache JMeter on your local machine and start the jmeter.bat file which is located inside the bin folder. Once you start the bat file you it will open up Apache JMeter as shown on the Figure.



Step 2

Now let us add the things which are required to do our task.
First right click on the 'Test Plan' element and add a Thread Group.
The next thing you need to add is a JDBC configuration element. To do this right click on the 'Thread Group' which you added a while ago and select 'Add -> Config Element -> JDBC Connection Configuration'.
Now you need to fill up the information to depending on the database which you have selected. Let us see what values we need to enter to test a Derby database. The following screen shot will give you a clear idea on this.



Step 3
The next step is to add a 'JDBC Request' element to enter you database query. Assume that you have created a database on your Derby database and that you have a table called 'COMPANY'. Let us see how you can query this database.

Right click on the 'Thread Group' and select 'Add -> Sampler -> JDBC Request'.
Since we are going to do select some data from the database, select the the option 'Select Statement' from the combo box 'Query Type:'.



Step 4
Now you need to find a way to view the performance. In order to do this you can add a listener to view the results. Therefore right click on the 'Thread Group' and select 'Add -> Listener -> Graph Results'



Step 5
Before running the test w need one more step to follow. That is to specify the number of threads. To do this click on the 'Thread Group' and specify 1000 as 'Number of Threads (users):' which is under 'Thread Properties'.

Let us try this out now. From the main menu select 'Run -> Start'. If you are executing the test for the first time it would ask you to save the test plan. Save the test plan at any location you prefer. Once the test has executed, you will see the output as shown in the following graph. You can do your test as you prefer by changing the number of threads.

Sunday, October 26, 2008

Developing a Research Thesis

The third semester is about to end of my MBA and it's time to spend some time on the MBA research. Selecting a research topic is difficult. Doing literature review and developing on the thesis is even harder. After a chat which I had with Dr. Sanjiva Weerawarana I decided that I should select a topic which would be useful for WSO2, my organization that I work for as well and therefore thought of touching the area of marketing open-source software. I have no clue on where to start and at the moment am browsing through the web and collecting related magazines, articles which I think might be useful for me.

I wish my father was alive because I'm sure I would have had great support from him since he has done similar kinds of stuff and helped a lot of other people who have done their research projects. He did his PhD on radiochemistry and his research paper is available on the web but unfortunately I cannot access is since I have to pay in order to download it.

I could have got some help from my dear old sister who is a medical doctor at the University of Ragama but alas she too is doing her PhD these days and I don't think I will get any help from her either (She too has written some articles on her research).

So I guess I'm alone on this and will have to do it on my own. Well of course we are expected to do it on our own but it would have been great if I had someone who's close to me who would at least would understand my stress at a time like this. I know that there will be a lot of people at office to help me out but it won't be the same. We will see how it goes. My only hope is to be able to complete it by 2009 and graduate with the rest of the batch. :-)

Friday, October 24, 2008

Creating your own Web Service with different session scopes

When creating a Web service you can create Web services of different session scopes. There are four session types in Axis2 such as,
1. SOAP Session Scope
2. Transport Session Scope
3. Request Scope
4. Application Session Scope

I will briefly explain how one can create Web service with each of these different session scopes.

Once you have created your Java class and complied it, you will need to write a services.xml before converting it into an archive file.

In order to create a service with a SOAP session scope all you have to do is add the following to your services.xml

scope="soapsession"

E.g.:- <service name="<service_name>" scope="soapsession">



I will be providing a sample service.xml for your reference.

<service name="Adding" scope="soapsession">
<description>
This service is created to add two numbers.
</description>
<parameter name="ServiceClass" locked="false">com.math.add.Adding</parameter>
<operation name="add">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation>
</service>