Showing posts from 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 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. Supp

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

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.

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 class at \src\main\java\com\test directory) Step 2 Update the pom.xml of your maven project as follows. <project xmlns="" xmlns:xsi="" xsi:schemaLocation=""> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>calculator</artifactId> <version>1.0-SNAPSHOT</version> <name>calculato

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 cla

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="" xmlns:xsi="" xsi:schemaLocation="

RESTful PHP Web Services by Samisa Abeysinghe

Samisa Abeysinghe , the director of engineering at WSO2 , attempts to explain the basic architectural concepts and step through examples of consuming and creating RESTful web services in PHP through his new book. This should be a vital reference for anyone interested in SOA. You could find more details of this book from PACKT web.

Reading a property of Axis2 services.xml from service Implementation class

There have been questions raised in Axis2 user list about reading some properties defined in services.xml from service implementation class. An easy way of doing that is as follows. 1. Suppose your services.xml is as follows and it has a parameter named, TestProperty. <service name="ParameterService"> <messageReceivers> <messageReceiver mep="" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/> <messageReceiver mep="" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </messageReceivers> <parameter name="ServiceClass">org.test.MyParameterService</parameter> <parameter name="TestProperty">This is a test property</parameter> </service> 2. We need to read the value of "Te

How to make an OSGI bundle using maven bundle plugin

OSGI (Open systems Gateway Initiative) specification defines a complete and dynamic component model which can be remotely installed, started, updated, stopped and uninstalled without restarting JVM. I'm not going to discuss the specification details of OSGI. You can find a lot of information from The objective of this post is to create a simple OSGI bundle using Apache Felix maven bundle plugin . Pre-requisites: Apache Maven2 Step 1 First we need to create a simple java class and which must be included in a proper directory structure therefore we can use Maven2 to build the source. Create the following directory structure in your file system. Create the following interface. package org.wso2; public interface GreetingService { public void sayGreeting(String s); } Create an Impl directory under wso2 and add the following class in there. package org.wso2.Impl; import org.wso2.GreetingService; public class GreetingServiceImpl implements GreetingService { public v

How to add a custom SOAP header to the request using AXIOM

Suppose you want to add the following SOAP header block to your web service request message. <myNS:header xmlns:myNS=""> This is a custom soap header </myNS:header > There are different approaches to add user defined headers to the request soap messages. Lets see how it could be done using AXIOM in simpler way. In this example we are going to invoke Axi2 default version service with adding a custom soap header in to the request. Pre-requisites Download and install Apache Axis2 Install Apache Tcpmon Step 1 Start Axis2 server by running AXIS2_HOME/bin/axis2server.bat{sh} Go to http://localhost:8080. You will see that the default version service is deployed there. Step 2 Now, we need to generate client stubs. Go to AXIS2_HOME/bin and run wsdl2java.bat{sh} with the following parameters. WSDL2Java -uri http://localhost:8080/axis2/services/Version?wsdl -o out -uw The client stubs will be generated in a directory called "out". Now, write a client

SOAP over JMS with Axis2

Axis2 provides a JMS transport implementation which can be used to send SOAP messages over JMS. This post will help you to - Configure JMS transport in Axis2 Generate Axis2 client Invoke default version service by sending request SOAP message over JMS Monitoring messages via JConsole I assume Apache ActiveMQ is used as our JMS implementation. However, you are free to use any other stack. Pre-requisites 1. Install the latest version of Apache Axis2 binary distribution 2. Install Apache ActiveMQ 5.0.0 Step 1 First, we need to start ActiveMQ message broker. Go to ActiveMQ_Install_dir/bin and run activemq.bat Step 2 In order to configure the JMSListener in axis2.xml, uncomment the following section. <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <parameter name="myTopicConnectionFactory"> <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFa

How to deploy JSR181 annotated class in Apache Axis2

JAX-WS (Java API for XML Web Services) provides support for annotating Java classes with metadata to indicate that the Java class is a Web service. With the annotations, you can expose java classes as web services with minimum effort. Apache Axis2 ships with JAX-WS support since its 1.4 release. This post explains the simplest possible scenario of JAX-WS support, how you can deploy an annotated class in Axis2. Pre-requisites Apache Axis2-1.4 or later JDK1.5 or above Step 1 Write an annotated class as follows. package org.apache.axis2; import javax.jws.WebMethod; import javax.jws.WebService; @WebService public class Calculator { @WebMethod public double Add(double x, double y){ return x+y; } } Here, the @WebService annotation tells the server runtime to expose all public methods on the above class as a Web service. Also, with the @WebMethod annotation, you can specifically denotes the methods which are exposed in the web service. Step 2 Package the above class as a JAR (

WSO2 Data Services plugin for Eclipse WTP

WSO2 Data Services 1.0 provides you with a IDE plugin which can be integrated to Eclipse WTP. You can create and deploy data services to a remote or local data services server from IDE. This post demonstrates how a simple MySQL data service is created and deployed using Eclipse WTP. Pre-requisites Download and install WSO2 Data Services 1.0 Download and install Eclipse WTP We will create a data service using MySQL. Please follow the instructions provided in WSO2 Data Services Quick Start Guide to create a data base and populate data. Step 1 Download wso2 data services eclipse plugin ( from here and copy it to Eclipse_home/plugins directory. Start Eclipse and select a new workspace. Select Workbench to go to the work bench. Step 2 Open the new wizard selection window (File --> New -- Other). If you have copied to the eclipse plugins directory correctly, you will see WSO2 Data service wizard option in th

How to use assertions in JMeter SOAP/XML-RPC sampler

Assertions are essential components in a JMeter test plan. They are very important in regression testing in which you can compare test results with a pre-defined output.  As I explained here , JMeter Soap/xml-rpc request sampler can be considered as an one of the easiest mechanisms to test web services.  Lets see how assertions can be added to a Soap/xml-rpc sampler so that you can use it easily in automated web services regression testing. Before continue with this, you may go through  the following articles. Six different ways to testing a web service Using Apache JMeter to test Axis2 web services  Step 1 In this example we are going to invoke the sample version service that ships with Apache Axis2 . Therefore, please download Apache Axis2-1.4.1 binary distribution from here and extract it in your file system. Start Axis2server by runnning axis2server.bat{sh} Step 2 Start JMeter by running jmeter.bat or sh. Right click on Test Plan element and add a thread group. Then add the SOAP/

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 navigat

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 online documentation Step 1 Download and install wso2 data service solution. You may download the latest beta2 version from here . Just extract 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

How to avoid OutofMemory error when building projects with Maven2

You may have encountered outofMemory issues when building source with Maven2. This normally happens when Maven runs out of available system memory. In such case you have to set MAVEN_OPTS environment variable to increase the available memory. In Windows Open a command prompt in which you build the source and enter the following options. (Change the memory size according to the amount of memory in your system) SET MAVEN_OPTS=-Xmx1024m In Linux Open a shell and set the options as follows. export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m"

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.

How to use jconsole to monitor and manage WSO2 WSAS

Service or system monitoring and management are essential components of any SOA framework. WSO2 WSAS provides two different mechanisms to manage and monitor web services. 1. Ajax based GUI console 2. JMX based monitoring facility In this post, I'm going to demonstrate the second option, JMX based service and system monitoring component. You can find more information about WSAS GUI console from here . JMX (Java Management Extension) provides a set of tools and APIs for applying a standard client/server-based architecture to monitoring and management of a Java application. J2SE version 5.0 adds core support for the Java Management Extensions (JMX) into the Java standard libraries. We are going to use Jconsole, included in jdk1.5 or newer versions, to explore the management and monitoring capabilities provided by WSO2 WSAS. Pre-Requisites Download and install WSO2 WSAS-2.2.1 or later Step 1 JMX port is disabled by default in WSAS. Open WSO2WSAS_HOME/conf/server.xml and uncomment t

How to avoid " Key Size" error when invoking secured services in WSO2 WSAS

" Key Size" error is a common issue which occurs when you try to invoke a secured web service in an environment where the provision for java unlimited security jurisdiction is not done. This can be avoided by installing Java Cryptography Extension (JCE) unlimited strength jurisdiction policy files. 1. Suppose you are using jdk15. Go to 2. Go to the Other Downloads section and click on download link next to "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 5.0" 3. Download and extract it in to a directory. 4. You will find local_policy.jar and US_export_policy.jar files there in the extracted directory. Copy these two files to $JAVA_HOME/jre/lib/security directory. (These files will already be there. you may replace them) 5. Restart WSO2 WSAS and invoke your secured service again. You will not encounter the "invalidk

Six different mechanisms to invoke a web service

I recently published a tutorial at WSO2 Developers portal - Oxygen Tank , which demonstrates six different mechanisms to invoke a publicly available web service. This tutorial explains each mechanism using a set of simple steps and mainly focused on beginners to the web services. See the complete tutorial here

How to deploy Apache Axis2 on GlassFish Application Server

I have demonstrated the steps to deploy Apache Axis2 on BEA WebLogic , IBM WebSphere , JBoss and Resin application servers in my previous posts. This series is not complete unless the steps to deploy Axis2 on GlassFish server are explained. Lets see how Axis2 can be deployed on GlassFish server. It is quite straightforward and similar to the other application servers we have discussed so far. Pre-requisites: Download and install the latest version of GlassFish server from here . Step 1 Start GlassFish server. i.e:- Go to GlassFish_Home/bin and run asadmin script as follows. asadmin start-domain domain1 This will start GlassFish server in domain1. Step 2 Download Axis2.war from here Step 3 Access GlassFish administration console (In a browser, access http://localhost:4848). Log in to administration console (Default username=admin, password=adminadmin). Step 4 In the left navigation menu of the GlassFish admin console, select Enterprise Applications and click on Deploy. You will be

How to use tcpmon inside Eclipse

Apache TCPMon is an utility that allows the messages to be viewed and resent. It is very much useful as a debug tool. If you don't know much about this tool, you can find more information here , here or here . I found an extension of this great tool, which can be included as an Eclipse plugin so that developers can monitor message transmission within their workspace without opening a separate tcpmon instance. It is very cool indeed. Saliya Ekanayake , a colleague at WSO2 has developed this utility as part of his university project. Lets see how this tcpmon plugin can be used in Eclipse WTP. 1. If you haven't done yet, download and install Eclipse WTP 2. Download tcpmonitor-1.0.0.jar from here 3. Copy tcpmonitor-1.0.0.jar in to Eclipse_home/plugins directory 4. Start eclipse 5. Select Window --> Show View --> Other --> Tcp Monitor --> TCP Monitor 6. Tcp monitor will be added as an view tab. Now you can configure the necessary port settings and trace message tran

Web application testing in Ruby(Watir) - 2 minutes guide

Watir (pronounced as Water) is a free open source tool which can be used to automate web applications. It is an extension of Ruby programming language. Unlike most of the other testing tools it gains the advantage of powerful features of Ruby and simulate browser interactions in very simple manner. Lets see how a simple google search is automated using Watir in few steps. Pre-requisites Install Ruby (1.8.5-24 or later) Step 1 Install Watir. Open a command window or shell and issue the following commands gem update --system gem install watir The above two commands update gem installer and then install watir in your system. Step 2 Open SciTE ruby editor or notepad and start to create the following script. require "watir" ie = ie.goto("") ie.text_field(:name, "q").set("WSO2 WSAS") ie.button(:name, "btnG").click Step 3 Save the above file as SimpleTest.rb and run it from the command line by typing Simp

How to validate a WSDL using Eclipse

When you create a wsdl file from scratch or use an already designed one, you must make sure it is valid. In other words it should; consist of well-formed XML (All tags should be closed and nested properly) conform to XML Schema comply with the rules and standards defined in WSDL specification valid with the rules defined by WS-I (Web services interoperability organization) Eclipse Web tools project (WTP) provides a very useful tool which validates a wsdl against above rules/standards. Lets see how we can validate an existing wsdl using Eclipse wtp. 1. Download and install Eclipse wtp 2. Open eclipse IDE 3. Start to create a new wsdl (File --> New --> other --> Web Services --> WSDL) 4. Give a name to the wsdl (you can provide the name of wsdl which needs to be validated) and click on next. Accept the default options and click on Finish. 5. You will see a design view of a new wsdl file. Move to source view by selecting "Source" tab. 6. You will see an skeleton so

Apache JMeter book is published

There are no much books available on test automation and tools. In order to fill the void in the software testing bibliography, Emily H. Halili decided to put together the basic concepts of test automation and performance testing with JMeter . This book was designed to pave the path for readers to get detailed insight on JMeter as well as a basic reference guide. I was the technical reviewer of this book. It consists of 140 pages and 8 chapters, starts with a short introductory chapter on advantages of test automation and requirements of automated tests. Chapter 2 focuses on an overview of JMeter followed by setting up environment and installation. Chapter 4, The Test Plan shows you all the parts of JMeter test plan. It explains all elements of test plan and how they interact together. Use of Jmeter in load/performance testing is demonstrated in chapter 5. In chapter 6, you will get information on the tools in JMeter that support functional or regression testing. Chapter 7 and 8 desc