Showing posts with label WSO2. Show all posts
Showing posts with label WSO2. Show all posts

Sunday, June 30, 2013

Helping hands in the world of enterprise middleware - Technical Support

Recently, I got an opportunity to work on a domain which is bit different from my subject matter specialization, software testing and quality assurance. I started to work as a lead of technical support team at WSO2 since November 2012. I thought to put together some key observations I made in technical support career in general and how I position it in terms of my beliefs.

Willingness to help - the most important characteristic of a support engineer

Are you really a helping hand regardless of your profession? How can I understand my willingness in helping others. I would simply list down some questions to evaluate your likelihood to help others.

Do you get frustrated when someone requests your help? If someone asks a question, what is your initial reaction?
In our life, we have seen people who do not even look at the person who requested help. Some people just route the request to some other party without even understanding what kind of help is required.

If you are really a helping hand, you just do not do it because of your professional obligations. You do it simply because you like to help others. You enjoy by observing how your help solves some other's problems.

If you are generously help people in need without hesitation, you possess one of the fundamental characteristics expected from a good technical support engineer.

Listening to others and clear in communication

A good support engineer always listen to others very carefully. She raises many follow-up queries to get the question clarified. She does not attempt to solve the problem blindly without completely understanding the issue at hand. She also communicates very clearly with the clients as well as the other stake holders to help in providing the the best answer.

Expertise in user perspective

Support engineers are clients advocates who should look at the problem through customer point of view. How painful is this issue to my clients? How does it affect their business transactions? When you approach problem from the customer point of view, you first look at what needs to be done before considering how you are going to address the concerns.

Enthusiastic in learning new technologies

To help needy people, you must have a good understanding about the relevant subject matter. You will be clueless if you do not know the problem domain. This is one of the most important attributes especially  in middleware technical support. You will not at least understand a basic question, if you do not step in to learn the technology. The technical support engineer should eager to learn various technologies and find out various solutions to address common problems that can occur.
At WSO2, technology becomes obsolete quite frequently. The technical support engineer must stay up-to-date with the latest features and enhancements introduced to the product platform.

Focus on SLA

Generally, technical support contracts are based on different Service Level Agreements (SLA). There can be various levels of SLA policies. A good support engineer always consider his SLA is now and act fast to find the best resolution for client's issue.

More experiences on technical support, specially related to WSO2 product platform are to be followed....


Thursday, September 13, 2012

Setting up minimum deployment of WSO2 product cluster with management/worker separation

The latest version of WSO2 Carbon (Carbon-4.0.0) platform (WSO2 ESB-4.5.0, WSO2 Application Server-5.0.0, WSO2 Governance Registry - 4.5.0 etc) supports a new deployment model which allows you to setup product clusters with separated worker and management nodes. In a worker/manager separated cluster setup, the management node(s) is used to deploy and configure the deployment artifacts where as the worker nodes are used to serve the requests received by clients.
I'm not going to spend much time on a detailed explanation about this new deployment approach since my objective is to take you through the minimum worker/manager deployment setup of WSO2 Application Server cluster as quickly as possible. You can find more about the theoretical aspects of this new deployment model in Afkham Azeez's blog.

Deployment diagram



















We are going to setup the minimum cluster setup in our local machines. Thus, we will use 3 product instances as follows.

Load Balancer - used to load balance the requests between Application Server cluster nodes.
WSO2 Application Server management node - all deployments and configurations are performed through this node.
WSO2 Application Server worker node - Application server requests are served by this node.

Pre-requisites:

Download the latest version (5.0.0) of WSO2 Application Server from here.
Download the latest version(2.0.0) of WSO2 Elastic Load Balancer from here.

Setting up WSO2 Elastic Load Balancer


Step 1:
Extract wso2elb-2.0.0.zip into a directory in your local file system. Let the extracted directory be WSO2_LB_HOME

Step 2:
Go to WSO2_LB_HOME/repository/conf and edit the loadbalancer.conf as follows.

appserver {
domains {
CharithaASdomain {
hosts mgt.charitha.appserver.wso2.com;
sub_domain mgt;
tenant_range *;

}
CharithaASdomain {
hosts charitha.appserver.wso2.com;
sub_domain worker;
tenant_range *;
}

}
}

As you can see above, we have defined two cluster sub domains, mgt and worker under a single clustering domain which is named as "CharithaASdomain".
Both these sub domains consists of one WSO2 Application server instance in each. mgt sub domain includes the management node of our cluster and the worker sub domain consists of a worker node. (See the deployment diagram above).
The two WSO2 Application Server instances (in our case cluster sub domains, because each sub domain has only one instance) can be setup in two physical servers, 2 VM instances or a single machine. In our example, we will set everything up in our local machine. In order to identify the two nodes uniquely, we will define hostnames for both. Therefore, mgt subdomain will be identified using mgt.charitha.appserver.wso2.com and the worker subdomain will be identified by  charitha.appserver.wso2.com
Since we are running everything in local machine, let's update the /etc/hosts file to match up with the hostnames we use.

127.0.0.1 mgt.charitha.appserver.wso2.com
127.0.0.1 charitha.appserver.wso2.com

Step 3: 
Uncomment localMemberHost element in WSO2_LB_HOME/repository/conf/axis2/axis2.xml and specify the IP address (or host name) which you are going to advertise to the members of the cluster.

<parameter name="localMemberHost">127.0.0.1</parameter>

Save loadbalancer.conf, axis2.xml and /etc/hosts files.

The above are the only configurations which need to be done in WSO2 LB. You do not have to configure anything in other configuration files in the minimum deployment setup.
Now, start WSO2 Load Balancer by running wso2server.sh script which can be found at WSO2_LB_HOME/bin. You will see the following logs at server startup.

[2012-09-13 20:04:08,407]  INFO - TribesClusteringAgent Managing group application domain:CharithaASdomain, sub-domain:mgt using agent class org.wso2.carbon.lb.endpoint.SubDomainAwareGroupManagementAgent
[2012-09-13 20:04:08,408] INFO - TribesClusteringAgent Managing group application domain:CharithaASdomain, sub-domain:worker using agent class org.wso2.carbon.lb.endpoint.SubDomainAwareGroupManagementAgent
[2012-09-13 20:04:08,410] INFO - ServerManager Server ready for processing...
[2012-09-13 20:04:08,483] INFO - AutoscalerTaskServiceComponent Autoscaling is disabled.
[2012-09-13 20:04:08,537] INFO - PassThroughHttpSSLListener Starting Pass-through HTTPS Listener...
[2012-09-13 20:04:08,550] INFO - PassThroughHttpSSLListener Pass-through HTTPS Listener started on port : 8243
[2012-09-13 20:04:08,550] INFO - PassThroughHttpListener Starting Pass-through HTTP Listener...
[2012-09-13 20:04:08,555] INFO - PassThroughHttpListener Pass-through HTTP Listener started on port : 8280
[2012-09-13 20:04:08,557] INFO - TribesClusteringAgent Initializing cluster...
[2012-09-13 20:04:08,583] INFO - TribesClusteringAgent Cluster domain: wso2.as.lb.domain
[2012-09-13 20:04:08,587] INFO - TribesClusteringAgent Using wka based membership management scheme
[2012-09-13 20:04:08,599] INFO - WkaBasedMembershipScheme Receiver Server Socket bound to:/127.0.0.1:4000
[2012-09-13 20:04:08,699] INFO - WkaBasedMembershipScheme Receiver Server Socket bound to:/127.0.0.1:4000
[2012-09-13 20:04:08,846] INFO - TribesClusteringAgent Local Member 127.0.0.1:4000(wso2.as.lb.domain)
[2012-09-13 20:04:08,847] INFO - TribesUtil No members in current cluster
[2012-09-13 20:04:08,849] INFO - TribesClusteringAgent Cluster initialization completed.
[2012-09-13 20:04:09,412] INFO - StartupFinalizerServiceComponent WSO2 Carbon started in 14 sec

Let's proceed with configuring WSO2 Application Server management node.

Setting up WSO2 Application Server Management Node


Step 1:

Extract wso2as-5.0.0.zip into a directory in your local file system. Let the extracted directory be WSO2_AS_MGR_HOME.

Step 2 (axis2.xml configuration):

First, we need to enable clustering at axis2 level in order for management node to communicate with load balancer and the worker nodes. Open  WSO2_AS_MGR_HOME/repository/conf/axis2/axis2.xml and update the clustering configuration as shown below.

<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="true">

<parameter name="membershipScheme">wka</parameter>

Specify the cluster domain. Note that, this must be the same which we defined in loadbalancer.conf

<parameter name="domain">CharithaASdomain</parameter>

<parameter name="localMemberHost">mgt.charitha.appserver.wso2.com</parameter>

<parameter name="localMemberPort">4250</parameter>

We will add a new property "subDomain" and set it to "mgt" to denote that this node belongs to mgt subdomain of the cluster as we defined in loadbalancer.conf.
  <parameter name="properties">
<property name="backendServerURL" value="https://${hostName}:${httpsPort}/services/"/>
<property name="mgtConsoleURL" value="https://${hostName}:${httpsPort}/"/>
<property name="subDomain" value="mgt"/>

</parameter>

Now, add load balancer IP or host name (in our case, we will refer to the load balancer using 127.0.0.1 and the local member port (4000) as defined in the axis2.xml of WSO2 LB) as a well-known member.
<members>
<member>
<hostName>127.0.0.1</hostName>
<port>4000</port>
</member>
</members>

Step 3 - catalina-server.xml configuration:
WSO2 Application Server management node is fronted by Load Balancer. Therefore, we need to configure the proxy ports which are associated with HTTP and HTTPS connectors. These proxy ports are the corresponding transport receiver ports opened by WSO2 LB (configured in transport listeners section in axis2.xml).
Open WSO2_AS_MGR_HOME/repository/conf/tomcat/catalina-server.xml and add the proxyPort attribute for both HTTP and HTTPS connectors as shown below.

<Connector  protocol="org.apache.coyote.http11.Http11NioProtocol"
port="9763"
proxyPort="8280"

 <Connector  protocol="org.apache.coyote.http11.Http11NioProtocol"
port="9443"
proxyPort="8243"

Step 4 - carbon.xml configuration:

Since we run multiple WSO2 Carbon based products in same host, we must avoid the possible port conflicts. Therefore, edit the following element in WSO2_AS_MGR_HOME/repository/conf/carbon.xml by assigning port offset 1 to the Application Server management node.

<Offset>1</Offset>

Update mgtHostName and HostName elements in carbon.xml as shown below.

<HostName>charitha.appserver.wso2.com</HostName>

<MgtHostName>mgt.charitha.appserver.wso2.com</MgtHostName>

We must do one more configuration change in carbon.xml before moving to the next step. As we discussed at the beginning, Application Server management node is used for deploying artifacts such as web applications and web services. The deployed artifacts in management node must be synchronized automatically to the worker nodes in cluster. This deployment synchronization mechanism is pretty straight-forward in WSO2 Carbon based products.  The default SVN based deployment synchronizer can be used to auto-commit the deployment artifacts to a pre-configured SVN repository. Then, the worker nodes can be configured to automatically check-out the artifacts from the same SVN location.

Let's configure SVN based deployment synchronizer in carbon.xml of management node.
<DeploymentSynchronizer>
<Enabled>true</Enabled>
<AutoCommit>true</AutoCommit>
<AutoCheckout>true</AutoCheckout>
<RepositoryType>svn</RepositoryType>
<SvnUrl>http://10.100.3.115/svn/repos/as</SvnUrl>
<SvnUser>wso2</SvnUser>
<SvnPassword>wso2123</SvnPassword>
<SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>
</DeploymentSynchronizer>

Make sure to replace the SvnUrl, SvnUser and SvnPassword according to your SVN repository.

Step 5: Starting the management node of WSO2 Application Server cluster

Go to WSO2_AS_MGR_HOME/bin and run wso2server.sh to start the server. During the server startup, you should see cluster initialization messages similar to the following.

[2012-09-13 23:04:25,820]  INFO {org.apache.axis2.clustering.tribes.TribesClusteringAgent} -  Initializing cluster...
[2012-09-13 23:04:25,840] INFO {org.apache.axis2.clustering.tribes.TribesClusteringAgent} - Cluster domain: CharithaASdomain
[2012-09-13 23:04:25,843] INFO {org.apache.axis2.clustering.tribes.TribesClusteringAgent} - Using wka based membership management scheme
[2012-09-13 23:04:25,852] INFO {org.apache.axis2.clustering.tribes.WkaBasedMembershipScheme} - Receiver Server Socket bound to:/127.0.0.1:4250
[2012-09-13 23:04:25,960] INFO {org.apache.axis2.clustering.tribes.WkaBasedMembershipScheme} - Added static member 127.0.0.1:4000(CharithaASdomain)


At the same time, look at the logs of Load Balancer.

[2012-09-13 23:04:41,012]  INFO - RpcMembershipRequestHandler Received JOIN message from 127.0.0.1:4250(CharithaASdomain)
[2012-09-13 23:04:41,012] INFO - MembershipManager Application member 127.0.0.1:4250(CharithaASdomain) joined group CharithaASdomain
[2012-09-13 23:04:41,013] INFO - ClusterManagementMode Member 127.0.0.1:4250(CharithaASdomain) joined cluster
[2012-09-13 23:04:52,016] INFO - DefaultGroupManagementAgent Application member Host:127.0.0.1, Port: 4250, HTTP:9764, HTTPS:9444, Domain: CharithaASdomain, Sub-domain:mgt, Active:true joined application cluster

By looking at the above logs, we can conclude that Application Server management node has successfully joined cluster and ready to receive requests through the load balancer.
Now, we can log in to the management console of the Application Server management node. Access https://mgt.charitha.appserver.wso2.com:8243/carbon/ and log in to the management console with the default administrator credentials (admin/admin). Go to the "Deployed Services" page and click on WSDL1.1 link of the HelloService. You will get an HTTP 500 error since the server looks for the URL, http://charitha.appserver.wso2.com:8280/services/HelloService?wsdl, which is not yet available. As you can see from this URL, though the service is deployed in the management node, all requests are served by the worker nodes. charitha.appserver.wso2.com is the hostname which we have given for the worker node and we have not started the worker node yet.


Setting up WSO2 Application Server Worker node


Since we have completed setting up the management node, worker node configuration is quite straight-forward. Let's configure the worker node in our local machines.

Step 1:
We are not going to extract another fresh version of wso2as-5.0.0.zip. Instead, make a copy of the management node into a different directory, so that we can reuse most of the settings which we used above. Rename the directory as wso2as-5.0.0-worker. Let this directory be WSO2_AS_WORKER_HOME.

Step 2 - axis2.xml configuration:
In addition to the changes which we did in axis2.xml of the management node, there are few modifications need to be done for worker. First, we update localMemberPort element since we launch two instances of cluster nodes in the same machine. Open WSO2_AS_WORKER_HOME/repository/conf/axis2/axis2.xml and edit the following element.

<parameter name="localMemberPort">4251</parameter>

Application Server worker node belongs to the "worker" sub domain of the cluster domain as we have configured in loadbalancer.conf of WSO2 Load Balancer. As we did with the management node, we can add a new property, "subDomain" as follows to represent this.

<parameter name="properties">
<property name="backendServerURL" value="https://${hostName}:${httpsPort}/services/"/>
<property name="mgtConsoleURL" value="https://${hostName}:${httpsPort}/"/>
<property name="subDomain" value="worker"/>
</parameter>

Step 3: carbon.xml configuration:

First, we should specify a new port offset for the worker node. Edit WSO2_AS_WORKER_HOME/repository/conf/carbon.xml and update the portOffset value as follows.

 <Offset>2</Offset>

Also, update the HostName element as shown below. We do not need to specify MgtHostName element since this node is designated as the worker node in Application Server cluster.

<HostName>charitha.appserver.wso2.com</HostName>

Now, we need to configure the SVN based deployment synchronizer to automatically check-out deployment artifacts from a common SVN repository. The worker nodes of a cluster SHOULD NOT commit (write) artifacts hence we must disable AutoCommit property in the deployment synchronizer configuration as shown below.

<DeploymentSynchronizer>
<Enabled>true</Enabled>
<AutoCommit>false</AutoCommit>
<AutoCheckout>true</AutoCheckout>
<RepositoryType>svn</RepositoryType>
<SvnUrl>http://10.100.3.115/svn/repos/as</SvnUrl>
<SvnUser>wso2</SvnUser>
<SvnPassword>wso2123</SvnPassword>
<SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>
</DeploymentSynchronizer>

Step 4: Start WSO2 Application Server Worker node

We are ready to start the worker node of our cluster. Go to WSO2_AS_WORKER_HOME/bin and start the server as follows. Note that, the workerNode system property must be set to true when starting the workers in a cluster.

sh wso2server.sh -DworkerNode=true

Once the worker node joins the cluster, you will see the following messages in WSO2 Load Balancer logs.
[2012-09-14 06:32:41,050]  INFO - RpcMembershipRequestHandler Received JOIN message from 127.0.0.1:4251(CharithaASdomain)
[2012-09-14 06:32:41,051] INFO - MembershipManager Application member 127.0.0.1:4251(CharithaASdomain) joined group CharithaASdomain
[2012-09-14 06:32:44,387] INFO - ClusterManagementMode Member 127.0.0.1:4251(CharithaASdomain) joined cluster
[2012-09-14 06:32:52,052] INFO - DefaultGroupManagementAgent Application member Host:127.0.0.1, Port: 4251, HTTP:9765, HTTPS:9445, Domain: CharithaASdomain, Sub-domain:worker, Active:true joined application cluster

Testing the cluster

There are many ways to test our cluster deployment. Let's follow the simplest path. 

- Log in to the management console of Application Server management node 
- Deploy a new Axis2 Web service (Go to Manage --> Axis2 Services --> Add --> AAR service)
- Once the service is deployed in the management node go to the services list and click on Tryit
- Invoke the service

You will notice that the requests are served by the worker node of the cluster. If you click on WSDL1.1 link of any service, the WSDL will be served by the worker (http://charitha.appserver.wso2.com:8280/services/HelloService?wsdl)

Let me know if you come across any issues when setting up the cluster. 

Monday, September 12, 2011

Must attend talk in WSO2Con2011 - Engineering to take over the world by Samisa Abeysinghe

WSO2Con 2011, a week full of tutorials, tech talks, networking events will be commenced shortly at WatersEdge, Colombo, Sri Lanka. If you are attending the conference, I'm sure you will look for a session which gives you an overall picture about how WSO2 has become a leading technology provider and what are the secret ingredients of the process that has been followed.

There is no other individual than Samisa Abeysinghe, VP of Engineering at WSO2, who knows top to bottom of WSO2 engineering process as well as lead the engineering team for the last five years to become where we are now. If you are bored with listening to traditional process sermons which are usually heard in conferences, this will be a totally different session for you. We are at WSO2, while redefining the middleware space, reinventing the software development process too. We have our own way of designing, developing and testing products. Wanna know more about how we do that? then do not forget to attend the session by Samisa which will be held on 15th of September 2011 at 15.30 PM!

Sunday, September 11, 2011

Must attend talk in WSO2Con2011 - Security in practice by Prabath Siriwardhana

Time flew in light speed and finally the days have arrived! WSO2Con 2011, a conference which you should not miss. Though you are a seasoned IT professional or a student keen in learning latest technologies, it is the event of the year.

Out of more than 25 sessions which are planned to be held, my attention goes to one particular session first. It is "Security in Practice" by Prabath Siriwardhana which will be held on 14th of September, 2011 at 3.30 PM. Why do I like it than any other session?

Prabath is a brilliant speaker. I like the way he presenting. He has his own style which attract anyone in the audience.

Prabath is the expert of the most complex and hard-to-understand aspect of Service Oriented Architecture, Security.

You can imagine the complexity of delivering a presentation in such a tough, complicated subject matter

But, Prabath has the ability to inject complex subject matters into your head in very nice manner. You should not miss this great session of Prabath if you are attending WSO2Con 2011!

Saturday, October 10, 2009

The newest version (2.0.1) of WSO2 carbon family of prodcuts released!!

The latest version of WSO2 carbon based products were released yesterday. More info can be found at http://wso2.org/projects/carbon

New Features in This Release
----------------------------
* Improved transaction support.
* Improved Support for deploying on top of WebSphere, WebLogic, and
JBoss.
* P2 based provisioning for WSO2 Carbon family of products.
* Numerous bug fixes.

Monday, September 7, 2009

Saturday, June 27, 2009

WSO2 SOA Summer School - Security in SOA

Prabath Siriwardana, a colleague at WSO2, doing a webinar on Security in SOA on 2nd of July 2009.
You can register from here

Thursday, February 5, 2009

Sunday, December 7, 2008

Fast Reliable Integration with WSO2 Carbon

I was out of blogging for few weeks due to the extremely busy schedule of WSO2's next revolutionary product suite, Carbon.
Samisa has explained the summarized view of Carbon in his post, Carbon in Pictures.
With Carbon, you will get the features of fully fledged SOA platform. You will plug in Service hosting components in to ESB with minimum effort. There are much more..
Stay tuned.. This blog will be updated with a lot of helpful materials once Carbon is out.

Friday, September 19, 2008

Throttling request messages with WSO2 Data Services

WSO2 Data services 1.0 has been released now. This free and open source product consists of a lot of useful features which can be used to implement your SOA based systems with minimum effort.
Access throttling can be considered as a new and vital feature included in it.
In web services interactions, we usually have requirements to restrict number of requests our web services serve for a given client. Also, we need to allow service access to a specified domain or IP range.
WSO2 Data Services provides an easily configurable UI based utility to throttle messages targeted to a particular data service or a set of services.
This post will take you through a basic throttling configuration.

Pre-requisites
Download and install WSO2 Data Services 1.0

Step 1
Start server by running WSO2DS_HOME/bin/wso2server.bat{sh}
Access wso2 data service management console (https://localhost:9443/ds)
Log in to console with default admin credentials (admin/admin)
Select Data Services link in the left navigation menu. You will be directed to the Deployed Services page.
Click on the default service, CustomerService
You will see the following page.



Step 2

Click on Throttling link which is placed under Quality of Service in the above page.
Throttling Configuration for CustomerService Service page will be displayed.
Select "Yes" from Enable Throttling drop down.
Default throttling configuration will be displayed as follows.



In the above table, Range denotes the IP addresses and domains to be restricted.
Remove the second row of configuration table.
In this demonstration we will restrict accessing the default CustomerService to the requests originating from local host. Therefore you can leave "other" as the range "IP" as type.

There are three access levels.
Allow - All requests are allowed without applying any restriction for the specified range
Deny - Access is denied for all requests comes from the given range
Control - Restrictions are applied based on the given constraints (Max Request Count, unit time and prohibit time period)

In this demonstration, we are going to use "Control" access level. Hence, Change the Access level to "Control". Max Request Count, Unit time and prohibit time period text boxes will be enabled.

Enter 10 as Max Request Count. 100000 as Unit time and 20000 as prohibit time period.
This means, our sample data service (CustomerService) accepts only 10 requests from localhost during 100 seconds (100000ms) . If all 10 requests hits the server before unit time expires (before 100 seconds), no more requests are allowed in to the service within 20 seconds (20000ms) as specified in prohibit time period.

A more detailed explanation on these terms can be found in the inline help of WSO2 Data services management console.

Click on Finish button to save the throttle configuration.


Step 3

Our throttling configuration is over by now. Lets invoke the sample service 10 times and see how throttling works.
Go back to the service management page of the CustomerService and click on Try this Service link.
Select "customersInBoston" operation and click on "customersinBoston" button. Hit this button 10 times to send 10 requests to CustomerService.
Send one more request. You will receive a fault similar to the below.

Fault: Access deny for a caller with IP 127.0.0.1 : Reason : You cannot access this service since you have exceeded the allocated quota.

Monday, September 15, 2008

Getting started with WSO2 Data Services

As I mentioned in a previous post, WSO2 Data Services is now available for you to download and try out. WSO2 Data Services is an open source product and it is available under apache license.

The objective of this post is to get you start with WSO2 Data Services with minimum configuration steps. You can find more details of WSO2 Data Services solution from wso2.org online documentation

Step 1
Download and install wso2 data service solution. You may download the latest beta2 version from here. Just extract wso2-dataservices-1.0-xx.zip in to a directory in your file system.
We refer this directory as WSO2DS_HOME.

Step 2
Start wso2 data services solution. Go to WSO2DS_HOME/bin and run wso2server.bat{sh}

Step 3
WSO2 Data services provides a web service interface for data stored in relational data bases, csv or Microsoft Excel files. Since our intention is to get our first data service running as quicker as possible I will use a simple csv file as the data source.
Open a text editor and create a csv file as follows.

id,name,address
01,charitha,colombo

02,Michel,Dallas

03,John,Westborough


Save this file as employee.csv.

Step 4
Access WSO2 Data Services management console. Open a browser and go to http://localhost:9443/ds
Click on Sign-in link at the top right corner. Enter username = admin and password = admin as login credentials.
You will be directed to the home page of Data Services management console.



Step 5

Click on Add from the left navigation menu. The step one of data service creation wizard will be shown.
Enter csvservice as the Service name and click on Next.

Step 6

Select csv as the data source type and click on Add.


Step 7

In CSV Data source configuration window, enter the following values.
Id = 1
CSV File location = D:\temp\employee.csv
Column Seperator = ,
Starting Row = 2
Max. no of rows to read = -1
Headers Available = TRUE
Column Selection (You can click on the column names specified in the drop down. Then it will add column numbers according to the sequence of selection)
id as column no:1
name as column no:2
address as column no:3



Step 8

Click "Next" from the data service wizard step 2. You will be directed to the step 3 where you can create queries for the service.
Click on "New Query" button.
Add New Query window will be popped up. Enter the following values.

QueryID = q1
DataSource = 1
Grouped by element = emps
Rowname = emp

Click on "Add New output mapping" button. In "Add new Output mapping" window, enter the followings. (Repeat this with name and address columns as well)
Mapping Type = Element
Output field name = id
CSV Column ordinal = 1



Step 9

If query is configured as in the previous step, you should notice the following elements in the "Preview of Data service configuration" section.
<query id="q1" useConfig="1">
<result element="emps" rowName="emp">
<element name="id" column="1" />
<element name="name" column="2" />
<element name="address" column="3" />
</result>
</query>

Click on next button of the Data Service Step 3 to continue with the wizard. Step 4 will be displayed where the service operations are configured.

Click on Add New Operation button.
"Add New Operation" pop-up window will be displayed. Enter the following values.
Operation name = op1
Query = q1
Click OK

Now all the data service configuration steps are done. Click on Finsh button to deploy our CSV data service.

Step 10
csvservice will be added to the deployed services list in Deployed Services page.
Lets invoke our data service using the simplest service invocation mechanism and see we get the data stored in csv file as the output.

Click on csvservice. Service Management page will be displayed.
Select Try this service link.
Click on op1 button and you will get the results as follows.

Thursday, September 4, 2008

Data Services-1.0Beta - The latest member of WSO2 SOA middleware suite

We have been working hard over the last few weeks to launch the newset addition to the WSO2's SOA middleware platform, WSO2 Data Services -1.0beta. Now you can download it and explore the power of web services with relational data, data stored in csv or Microsoft Excel files. 
WSO2 Data Services provides a convenient and user-friendly mechanism to expose data as web services and utilize a lot of QOS features such as WS-Reliable Messaging, WS-Security etc..
It consists of a management UI which allows you to create, deploy and invoke data services without writing a line of code. Also, Eclipse IDE plugin brings the Data servce functionality into Eclipse IDE in which you can configure data services very easily. 

There are lot more things you can do with this new product and some of the helpful references were already published. You may begin with quick start guide.
Stay tuned. This blog will be updated with many how-tos on WSO2 data services soon.

Wednesday, June 25, 2008

WS-Reliable Messaging with WSO2 WSAS - II

This is the part two of my previous post on WS-Reliable messaging with WSO2 WSAS - 1
I'd suggest you to follow the steps given in there before proceeding with this.

We looked at how WSO2 WSAS and WSO2 Mercury module are used in one-way (IN-ONLY) message interaction in reliable manner. In this post I'll explain the procedure to do the same with Request Reply(IN-OUT) messaging system using single transport channel.

Step 1

Follow the step 1 - Service Configuration and step 2 - Generate stubs of part one of this post with the service implementation class given below.

package org.wso2.wsas.service;
public class MercuryService{

//Twoway messaging
public int Add(int a, int b){

try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return a+b;
}
}

Note that I inserted a Thread.sleep() in service to wait ~3 seconds before returning results so that we may have enough time to block the transport channel when testing reliable message transmission.

Step 2

If you have followed the step 1 and step 2 exactly as given in part 1 of this post by just replacing service impl. class with the above, you should be able to continue with the client as given below.

Open your IDE and write the following client to invoke service with RM.
Make sure to add jars in WSAS_HOME/lib and the generated client stub jar to your class path in order to compile the client.

public class RequestReplyAnnonClient{

public static void main(String args[])throws AxisFault{

ConfigurationContext cc = ConfigurationContextFactory.createConfigurationContextFromFileSystem
("C:\\RM\\client-repo"+"C:\\RM\\client-repo\\conf\\axis2.xml");

MercuryServiceStub stub = new MercuryServiceStub(cc);
MercuryServiceStub.Add request = new MercuryServiceStub.Add();
request.setA(12);
request.setB(8);

stub._getServiceClient().engageModule("Mercury");

for (int i = 0; i < 29; i++) {
try {
//Two-way invocation
MercuryServiceStub.AddResponse response = stub.Add(request); System.out.println(response.get_return());
} catch (RemoteException e) {
e.printStackTrace();
} try
{
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// Setting the last message stub._getServiceClient().getOptions().setProperty("MercuryLastMessage", Constants.VALUE_TRUE);
try {
MercuryServiceStub.AddResponse response = stub.Add(request); System.out.println(response.get_return());
} catch (RemoteException e) {
e.printStackTrace();
} try
{ Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
In order to have the reliable messaging support at the client, we need to engage Mercury module with "stub._getServiceClient().engageModule("Mercury")". We also need to have ConfigurationContext to define the client repository where the Mercury.mar and axis2 configuration file (axis2.xml) is placed. Create a directory, client-repo and copy WSAS_HOME/repository/modules/mercury.mar to client-repo/modules directory. Also, create a sub-directory conf under client-repo and copy an axis2.xml file ( I have used axis2.xml copied from Axis2-1.4) in to that folder. As in one-way scenario, we need to let Mercury know when we are complete. The simplest way to do this is to mark the LastMessage with stub._getServiceClient().getOptions().setProperty("MercuryLastMessage", Constants.VALUE_TRUE)

Step 3

Compile and run the client. You should configure tcpmon in order to monitor request and response messages.

You will notice that the first message travels through tcpmon contains <wsrm:CreateSequence> as the first first child of soap body. If the transport channel does not get blocked, CreateSequenceResponse message will be returned to client immediately.

You will see that <wsrm:MessageNumber>1</wsrm:MessageNumber> soap header element in the next message where the actual request payload is transmitted. The response of this message may include <wsrm:SequenceAcknowledgement> which denotes the ack to the first message. This will be continued until the last message in which the <wsrm:LastMessage /> as a header element could be seen. (In our test, the message number should be 30)
The end of whole sequence will be denoted by TerminateSequance message.

Lets check whether the reliability is actually provided by WSO2 mercury module when the transport channel is interrupted.

When the 3rd message is sent (Message number 3), click on "Stop" button of Tcpmon listen port. You will see the following in tcpmon.



This mimics the behavior of typical network interruption in data communication. Wait a few seconds and restart the listen port.



As you can see, the response of request message number 3 will be returned when the transport channel is restarted and continues with the rest of the messages. No messages are lost though the channel interruptions are occurred. All 30 messages will be delivered reliably even the network communication issues are occurred during message transmission.

We have looked at one of a basic tests which can be done in order to verify how WSO2 WSAS and mercury module provides reliable message delivery in web service communication. There are more. I'll discuss them in a future post.

Monday, June 23, 2008

Retrieving web service metadata using wso2-mex module

I have published a Knowledge base post at Wso2 oxygen tank which describes the procedure to retrieve web service metadata using wso2 WSAS and wso2-mex module .
You will find it useful since there are no much documents available on the web regarding ws-MEX (ws-MetaDataExchange) configuration and usage.

Tuesday, June 10, 2008

WSO2 WSAS -2.3 is out!

WSO2 Web services application server (WSAS) - 2.3 was released yesterday. It was an extremely tough release. We were given the June 10th deadline less than 2 weeks back (on 27th of May). There were major changes happened in core Axis2. We were supposed to ship with Axis2-1.4 which had not been gone through a rigorous QA/test cycle to verify compatibility with WSO2 WSAS. It was one of the most challenging test/QA cycles I have ever gone through. It is obvious that less than 2 weeks are not enough to do a full scale functional/regression test, no option, we had to mange somehow.

Milestone builds were planned to out for QA testing on every friday though it did not happen. There were a lot of regression issues and most of them were uncovered during the initial QA tests. Fixes were getting delayed and some blockers avoided exercising some major features until last moment. Worked around the clock to complete functional as well as regression testing.
During the last few days 2-3 release candidates were out in a day. :) We had to make sure the regressions are minimum in between RCs. Interoperability with other SOA frameworks such as .NET was one of the major requirements expected from WSAS-2.3 release. Interop test suites were already in place when we started test cycles. However, most of java test suites were out dated, no build scripts or failed in execution. Therefore we had to update some of them/write from scratch.
Automated ant based functional test-framework helped to do quick smoke tests. However, as I expected and believed, good/critical defects were always uncovered during manual tests.

WSAS-2.3 release can be considered as a true TEAM effort. Everyone worked hard to get the things done within the given extremely tough deadline. I'm confident that WSAS-2.3 will also be demonstrated the better product quality as in previous releases though everything done within short time.

Finally our effort and hard work paid off as the interop demo of WSAS was very successful at the Microsofts' TECH ED 2008.

One thing I should mention here is, if the deadline is fixed (if it is not negotiable) and the schedule is very aggressive with limited time allocated for testing, you have to forget some process bullshit and work hard to find more and more BUGS. Yes, Risks are apparent, however you have to set the expectations with your leads making sure everyone understands the constraints/issues clearly.

WSO2 WSAS-2.3 release can be downloaded from http://wso2.org/projects/wsas/java

From the WSO2 WSAS 2.3 - Release Note - 10th June 2008
======================================================

WSO2 WSAS is an enterprise ready Web services engine powered by Apache
Axis2 which offers a complete middleware solution. It is a lightweight,
high performing platform for Service Oriented Architectures, enabling
business logic and applications.
Bringing together a number of Apache Web services projects, WSO2 WSAS
provides a secure, transactional and reliable runtime for deploying and
managing Web services.

Key Features
------------
* Data services support - Expose you enterprise data as a services in a
jiffy
* WSAS IDE - Eclipse IDE integration
* Clustering support for High Availability & High Scalability
* Full support for WS-Security, WS-Trust, WS-Policy and WS-Secure
Conversation and XKMS
* EJB service provider support - Expose your EJBs as services
* Axis1 backward compatibility - Deploy Axis1 services on WSAS & Engage
advanced WS-* protocols in front of legacy services
* JMX & Web interface based monitoring and management
* WS-* & REST support
* GUI, command line & IDE based tools for Web service development


New Features In This Release
----------------------------
* Improved interoperability
* Improved Data Services support
* Various bug fixes to Apache Axis2, Apache Rampart & WSAS
* WSO2 Mercury Integration - A new WS-RM Implementation

Data Services - Bringing Enterprise Data to Web
-----------------------------------------------
* Service enable data locked in relational databases, CSV & Excel files
in no time
* Zero code. Simple descriptor file describes the data to service mapping
* Controlled access to your data
* Customizable XML output
* Benefit from REST & WS-* support
* Built-in Connection pooling support
* Supports exposing Stored procedures & functions
* Built-in caching
* Throttling - to ensure your database is never overloaded.
* Easy configuration via graphical console
* Test your services via Try-it tool

Training
--------

WSO2 Inc. offers a variety of professional Training Programs, including
training on general Web services as well as WSO2 WSAS, Apache Axis2,
Data Services
and a number of other products.

For additional support information please refer to
http://wso2.com/training/course-catalog/


Support
-------

WSO2 Inc. offers a variety of development and production support
programs, ranging from Web-based support up through normal business
hours, to premium 24x7 phone support.

For additional support information please refer to http://wso2.com/support/

For more information on WSO2 WSAS, visit the WSO2 Oxygen Tank
(http://wso2.org)

How to do various things with WSAS - WSAS HOWTO
Series(http://wso2.org/library/2707)

For further information see the full release note
http://wso2.org/project/wsas/java/2.3/docs/release_notes.html

Saturday, April 19, 2008

Data services and mediating SOAP messages with Synapse DBReport mediator

Apache Synapse is an ESB that has been designed to be simple to configure, very fast, and effective at solving many integration and gatewaying problems. It comes with a set of ready-to-use transports and mediators.
Visit Apache synapse web for more information about message mediation.

WSO2 data services is a convenient mechanism to provide a Web service interface for data stored in some data source. Data sources such as relational databases, CSV files & MS-Excel files can be easily service enabled using Data Services.
You can find more details about WSO2 Data services from here

I got a lot of positive feedback about my previous posts (securing web services) since they helped beginners to understand and experiment with simple examples without digging in to complex details.
I thought to describe a simple scenario which demonstrates the usage of data services and synapse together. I hope the following step-by-step instructions will help most of the novice users to get started with WSO2 data services and Apache synapse in a fairly simple manner.

I am going to use the following open source software tools in this demonstration. So, please make sure you have configured them in your environment.

Apache Synapse 1.1.1 (Download)
WSO2 WSAS 2.2.1 (Download)
Apache derby 10.3.2.1 (Download)
Apache JMeter (Download)

Scenario:
A SOAP request will be sent to WSO2 WSAS to get the net salary of an employee which resides in a database. The messages will be transferred via synapse. The response SOAP message will be subjected to mediation by synapse DBreport mediator. In which, the net salary of a different employee will be updated by evaluating the net salary of the requested employee. In other words, we will get the net salary of employee A and instruct synapse to update employee B's net salary to the net salary of employee A.

Step 1

Database preparation

We should prepare the necessary database and tables as the first step. Apache derby will be used in this example.
  • Start derby network server
Go to derby_home/bin and run startNetworkServer.bat
  • Create a database
start ij utility (derby_home/bin/ij.bat) and enter the following command.
CONNECT 'jdbc:derby://localhost:1527/employeedb;user=wsas;password=wsas;create=true';
  • Create a table and insert data
create table employee(name varchar(10), empid varchar(10), netsalary double);
insert into employee values ('Sean','1',1000.00);
insert into employee values ('John','1',3000.00);
insert into employee values ('David','1',2000.00);

Next, I'm going to create a data service using the above data source. Data services allow users to expose the relational data as web services so that they can be accessed and manipulated in programming language independent manner.

Step 2

Create a data service

Please make sure the derby client driver is available in your WSAS instance. Copy derby_home/lib/derbyclient.jar to WSAS_HOME/lib.

Install WSO2 WSAS if it is not already installed. start WSO2 WSAS using WSAS_HOME/bin/wso2wsas.bat

Access WSAS management console (https://localhost:9443) where we can configure our data service through UI.

Go to 'Services and service group management' page and click on 'Define data service' link. You will get a page as given below.


Enter 'Synapsedataservice' as the service name. Select 'RDBMS' as the data source. A pop-up window will be displayed where we can configure data base details.
Driver Class = org.apache.derby.jdbc.ClientDriver
JDBC URL = jdbc:derby://localhost:1527/employeedb
user name= wsas
password = wsas

Click on the 'Next' after configuring data source details. The second step of the data service configuration will be displayed. Click on 'New query' button. The following pop-up window will appear.


Enter the following details in the above window.

Query ID=Empsal
SQL Statement =
select * from employee where name = ?


Click on ' add new input mapping' and enter followings.
Name=name
sqlType
=STRING

Grouped by element = employees
Row name = employee

Click on 'add new Output mapping' and enter the following values.
Mapping Type = element
Output field name = name, SQL column Name = name
Output field name = empid, SQL column Name = empid
Output field name = netsalary, SQL column Name = netsalary

After entering all of the above values, click 'Next' button in the data service - step 2.

Step 3 of the wizard will be displayed. Click on 'Add new operation' button and enter the following values.
Operation Name = EmpSalOp
Query= Empsal

Click 'Finish' to deploy the data service.

Step 3

Test the data service

You can test your data service simply by invoking it in RESTful manner. Issue the following url.
http://localhost:9762/services/Synapsedataservice/EmpSalOp?name=Sean

You should get the details of employee, Sean.

<datas2:employees>
<datas2:employee>
<datas2:name>Sean</datas2:name>
<datas2:empid>1</datas2:empid>
<datas2:netsalary>1000.0</datas2:netsalary>
</datas2:employee>
</datas2:employees>

You should observe the simplicity of exposing relational data using WSO2 Data services. Lets see how we can use Apache Synapse to do some mediation in messages passing through it.

Step 4

Creating Synapse configuration

Install Synapse1.1.1 (just unzip the binary distribution). Synapse provides a xml configuration file to define the mediation rules using synpase configuration language. Open Synapse_home/repository/conf/synapse.xml.

Remove the existing contents of that file and add the following configuration.

<definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main">
<in>
<send>
<endpoint>
<address uri="http://localhost:9762/services/Synapsedataservice"/>
</endpoint>
</send>
</in>
<out>
<log level="custom">
<property name="text"
value="** Reporting to the Database **"/>
</log>
<dbreport>
<connection>
<pool>
<driver>org.apache.derby.jdbc.ClientDriver</driver>
<url>jdbc:derby://localhost:1527/employeedb;create=false</url>
<user>wsas</user>
<password>wsas</password>
</pool>
</connection>
<statement>
<sqlupdate employee set netsalary=? where name='John'</sql>
<parameter expression="//datas2:employees/datas2:employee/datas2:netsalary"
xmlns:datas2="http://ws.wso2.org/dataservice" type="DOUBLE"/>

</statement>
</dbreport>
<send/>
</out>
</sequence>
</definitions>

Here, the request message pass through synapse will be directed to the data service endpoint without doing any mediation. It is defined in the <in/> element.
The SOAP response will be transferred via two different mediators.

Log - when the soap response reaches synapse, it just logs the message as defined.
dbreport - writes information to a Database, using the specified insert SQL statement.

In this configuration, we evaluate the response SOAP message using an XPath expression and get the net salary of the employee. Then we update the net salary of employee John with that.

Now you can start synapse with the above configuration by running synapse.bat.

To see how this works, we need to send a SOAP request message to Synapse. Apache Jmeter can easily be used to transmit a soap message.

Step 5

Test message mediation

Install jmeter in your system (Just unzip jmeter binary distribution). Run jmeter.bat.
Create a thread group and add SOAP/XML-RPC request sampler. (Please read http://wso2.org/library/1085 if you are not familiar with testing web services using Jmeter)

Add the following soap request in to the SOAP/XML-RPC data section.

<soapenv:envelope soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:body>
<axis2ns5:empsalop axis2ns5="http://ws.wso2.org/dataservice">
<name>Sean</name>
</axis2ns5:empsalop>
</soapenv:body>
</soapenv:envelope>

You may have wondered how I captured the above request Soap message. There are several different approaches.
1. write a java client and invoke the data service. Capture the message using apache Tcpmon
2. Enable Soap Tracing in the WSAS management console. As we did above, invoke the service in RestFul manner. Then access the SoapTracer in WSAS management console and copy the soap request. (This will be the easiest method)

Enter 'http://localhost:8080' as the URL in SOAP/XML-RPC request.
Enable 'Send SoapAction' and enter 'urn:EmpSalOp'

If everything is correct, you should see the following in your Jmeter console.



Run the sampler. You may check the synapse console where you can monitor the message mediation.

Lets see whether the net salary of John is updated as expected. Open the ij utility of Derby and issue the following SQL statement.
select * from employee;

You should notice that the net salary of John and Sean are same.

In this post, we looked at the WSO2 data services and Apache Synapse using a simple scenario. You will be able to improve the above scenario by applying more mediation rules.


Saturday, March 15, 2008

Invoking a public web service programmatically using WSO2 WSAS

A Web service is defined as "a software system designed to support interoperable interaction over a network." Web services are referred to as Web APIs that can be accessed over a network and executed on a remote system hosting the requested services.
There are many publicly available web services which can be invoked remotely using client applications. www.webservicex.net is such a site that hosts different types of public web services.
I'm going to demonstrate how such web service is invoked programmaticaly using WSO2 Web services application server (WSO2 WSAS)

WSo2 Web services application server provides set of tools to interact with web services. You can download the latest version from here.

I'll use a public instance of WSO2 WSAS to generate client side code (stub). You will also try out WSAS public instance before downloading the server.

Step 1

First, we may access webservicex to identify a suitable web service which can be invoked remotely.
You may see 'Top Web Services' at the left menu of the home page. Click on 'Stock Quote'
You will get a page with stock quote service details.

Make a note of the followings;
Endpoint http://www.webservicex.net/stockquote.asmx
WSDL Location http://www.webservicex.net/stockquote.asmx?wsdl

Step 2

WSO2 provides a set of shared instances of WSO2 Web services application server at http://wso2.org/tools. You can easily try out several features of web services application server with these instances.

Go to WSAS 2.2 shared instances page and select 'shared WSO2 WSAS Instance 1'. You will be directed to the home page of WSAS management console. Select WSDL2Code from the left navigation menu.
You will see the following page.



Enter 'http://www.webservicex.net/stockquote.asmx?wsdl' as the uri of WSDL. We need to generate a client to invoke the stock quote service. Therefore, you don't want to configure server side settings. Simply click on 'generate' leaving the other fields blank.

Within a few seconds, you will be prompted to save a zip file in your file system. Save it in your machine.

Step 3

Go to the directory where you saved the generated zip file. You will see src directory, pom.xml and build.xml file inside the zip file. src directory contains the StockQuoteStub and StockQuoteCallbackHandler classes which can be considered as proxies used in our client.

Now open a command window and go to the extracted directory where the above pom.xml exists.
Assuming you are using Eclipse as IDE, enter mvn eclipse:eclipse to generate the complete project structure which can be imported in to your IDE. (If Intellij IDEA is used, then use mvn idea:idea)

Depending on your network connection and the contents available in your maven2 repository, the above command takes some time to download the necessary jars to your m2 repo.

If everything is successful, you will see 'BUILD SUCCESSFUL' message.

Step 4

Open eclipse IDE. Select File-->Import.
Select 'Existing projects in to workspace'. In the 'Import Projects' window, browse for the root directory of the above location (where you extracted the generated zip file)
Select the project and click next

The complete project structure will be created with the generated artifacts. You may need to define M2_REPO classpath variable if you have not done it previously.

Step 5

Now use the generated stubs to create a java client under the above project to consume Stock Quote service.

public class StockQuoteClient {

public static void main(String[] args)throws AxisFault {
StockQuoteStub stub = new StockQuoteStub("http://www.webservicex.net/stockquote.asmx");
StockQuoteStub.GetQuote req = new StockQuoteStub.GetQuote();
req.setSymbol("IBM");
try {
StockQuoteStub.GetQuoteResponse response = stub.GetQuote(req);
System.out.println(response.getGetQuoteResult());
} catch (RemoteException e) {
e.printStackTrace();
}

}

}

Run the application. You will get the stock quote for IBM.