Tuesday, December 30, 2008

How to plug service hosting components in to WSO2 ESB

With the revolutionary WSO2 carbon framework, plugging in service hosting components in to WSO2 Enterprise Service Bus (ESB) is just a matter of seconds! It is extremely simple.

WSO2 ESB is an message mediation framework and the service endpoints usually hosted in a separate JVM. However there may be requirements to host the services inside ESB. There are different types of services you can deploy in a service container.

Axis2 web services
Pojo services

EJB services

Data services

Spring web services

Axis1 services
JaxWS services

Now, you can add any of these service hosting components in to your ESB. Lets see how it can be done.

1. Download WSO2 Enterprise Service Bus (ESB) -2.0 beta2
2. Extract the downloaded zip
3. Go to the bin directory in the extracted folder (ESB_HOME/bin) and run wso2server.sh or wso2server.bat
4. Point you browser to the URL https://localhost:9443/carbon and login as an admin (Use "admin", "admin" as the username and password)



5. Suppose you want JAXWS services are hosted in ESB. Then you need to have the jaxws service hosting components. You will be able to download the individual components from WSO2 Oxygen Tank soon. However, we will downlaod WSO2 WSAS-3.0-beta2 and get the components from it. Therefore, please download WSO2 WSAS 3.0-beta2 and extract the downloaded zip file in to local file system. (Lets name the extracted directory as WSAS_HOME)

6. Go to WSAS_HOME/webapps/ROOT/WEB-INF/plugins. You will find a lot of libraries inside that directory.
Copy org.wso2.carbon.jaxwsservices.ui_SNAPSHOT.jar, org.wso2.carbon.jaxwsservices_SNAPSHOT.jar and org.wso2.carbon.jaxws-2.1.jar files and paste them into ESB_HOME/webapps/ROOT/WEB-INF/plugins
7. Restart WSO2 ESB server
8. Log in to ESB management console again. You will find the JAXWS service component is listed in the left menu.



In this way, you can add any of the above service components into ESB. For example, if you want Axis2 service component inside ESB, you just need to copy org.wso2.carbon.aarservices-SNAPSHOT.jar and org.wso2.carbon.aarservices.ui-SNAPSHOT.jar as explained above.

Friday, December 19, 2008

A software architect's view on WSO2 QA methodology

Afkham Azeez, a software architect at WSO2 nicely puts together his observations of Quality Assurance practices by comparing them with the traditional QA processes.
As I always believe, the feedback of QA tasks must be come from the development team first. In an agile software process, it is really important to have feedback from the collegues of your team. You work with them. They know your approach and how you carry out your duties than the other hidden managers. Therefore, a good feedback from development team is definitely help a QA team to move forward.
I totally agree with Azeez on his idea on traditional vs agile/collaborative QA. We don't want our QA engineers to spend their valuable time filling huge excel sheets and writing comprehensive plans which are not even looked at during the test execution phases. Instead, our QA engineers learn SOA technologies, involve in community discussions, maintain technical blogs, researching on testability of features etc.. They are in a position to take over the QA testing of any SOA middleware with minimum ramp-up time. Since traditional QA people don't even look at the source code, our team write clients to invoke web services in reliable/secure manner, write DB scripts to port our products to run on different DBMSs and help developers in minor bug fixes during rush release cycles.
I must appreciate Azeez for sharing his view on QA which will help us to do a better job.

Saturday, December 13, 2008

New look of WSO2 WSAS SOAP Message Tracer

Soap Tracer may not be a strange tool if you are familiar with WSO2 Web Services application server (WSAS). However, you will notice a new look and improved graphical representation of SOAP messages in Soap Tracer shipped with WSAS 3.0.
You will experience the difference with the newly released WSAS-3.0-beta1

- Download and unzip the binary distribution
- Log in to management console with user name and password, admin/admin
- Select Soap Message Tracer in the left menu
- Change the status to ON
- Invoke a service (Simply run tryit with the default HelloService)
- Go back to Soap Message Tracer and see the request and soap messages

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.

Sunday, November 2, 2008

Axis2 java2wsdl maven plugin

I demonstrated the usage of Maven2 WSDL2Code plugin in a previous post. Apache Axis2 provides with a Java2WSDL maven2 plugin as well. Maven2 Java2Wsdl plugin can be used to generate WSDL from a java class. The following steps will help you to create a wsdl from a java class using Axis2 java2wsdl maven plugin.

Step 1
Create a mavan project (See step 1 of ).
Create a java class in the source directory of your maven project. (i.e:- Create Calculator.java class at \src\main\java\com\test directory)


Step 2

Update the pom.xml of your maven project as follows.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>calculator</artifactId>
<version>1.0-SNAPSHOT</version>
<name>calculator</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-java2wsdl-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java2wsdl</goal>
</goals>
</execution>
</executions>
<configuration>
<className>com.test.Calculator</className>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
</project>

Note the highlighted elements in the above pom. First we added a new <plugin> to use java2wsdl goal. This goal accepts a set of parameters as explained in Axis2 online documentation.
In this example we used the simplest configuration parameter, <className>, which defines the fully qualified name of class from which the WSDL is generated.

Also, make sure to add a dependency to Axis2 jars in your pom.xml.

Step 3

Go to the root directory of your project structure and run the following command.

mvn clean axis2-java2wsdl:java2wsdl

You could find the generated wsdl at target\generated-resources\java2wsdl\ directory.

Saturday, October 25, 2008

Changing the default class loading mechanism of JBoss 4.2.* and WebLogic

Application servers use different class loading/delegation mechanisms. Therefore, we should understand them when deploying enterprise applications. In most cases, we need to override the default class loading behavior of application servers.
Suppose your web application wants to load classes from its own class loader first without delegating to parent. Then the following simple configurations will help you to override default delegation pattern in BEA WebLogic (version 8.* or 10) and JBOSS 4.2.*.

In WebLogic:

Set <prefer-web-inf-classes> to true in WEB-INF/weblogic.xml of your war.

Read WebLogic Server application classloading for more information.

In JBoss:

Set java2ParentDelegation to false in WEB-INF/jboss-web.xml as follows.

<loader-repository>
org.test:loader=archive-name
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>

For more information about JBoss class loading, have a look at JBoss classloading configuration guide

Tuesday, October 21, 2008

How to use Maven2 WSDL2Code plugin in Axis2

Apache Axis2 ships with a lot of useful tools to make web service developer's life easier. Maven2 WSDL2Code plugin is one of them which can be used to generate server side skeletons or client stubs from a given WSDL using a maven pom.xml.
Lets see how this plugin can be used.

Pre-requistes:
Apache Maven2

Step1

Create a maven project using maven archetype template (You may ignore this step and use an existing project if you are familiar with maven)

mvn archetype:create -DgroupId=com.test -DartifactId=calculator

This will create a maven project structure as follows.



Step 2

Create a directory (i.e:- resources) at src\main and copy your WSDL file there.
Now, remove the existing contents of the auto-generated pom.xml (calculator\pom.xml) and add the following configuration.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>calculator</artifactId>
<version>1.0-SNAPSHOT</version>
<name>calculator</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>wsdl2code</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>org.charitha</packageName>
<wsdlFile>src/main/resources/calculator.wsdl</wsdlFile>
<databindingName>adb</databindingName>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
</project>

Note the highlighted elements in the above pom. First we added a new <plugin> to use wsdl2code goal. The WSDL2Code goal takes a set of input parameters as explained here.
In this example, we use 3 configuration parameters.
<packageName> - The generated source will be added to this package
<wsdlFile> - The location of the input wsdl file
<databindingName> - Databinding mechanism used for code generation

Also, we need to add a dependency to Axis2 jars.

Step 3

Go to the root directory of your project structure (i.e:- calculator directory where pom.xml exists) and run the following command.

mvn clean axis2-wsdl2code:wsdl2code

You could find the generated classes at target\generated-sources\axis2\wsdl2code directory.

Note: The sample wsdl used for the above example can be found at http://ww2.wso2.org/~charitha/calculator.wsdl