Posts

Showing posts from February, 2008

Securing Axis2/WSAS web services with Username token

Image
Security is a crucial requirement in distributed computing. When it comes to web services, it is even more important. Apache rampart is the module which is used to secure an Axis2 web service. There are numerous approaches to secure your Axis2 web service using rampart module. Username token authentication can be considered as the simplest mechanism to protect your service. Lets see how the username token authentication is enabled in your web service and write a client easily using WSO2 WSAS which dramatically simplifies most of the complex steps. I will demonstrate the scenario using WSO2 WSAS 2.2.1. You can follow most of the steps given here with Axis2 as well. Lets assume WSO2 WSAS is configured in your system and it is up and running. (See WSAS installation guide if you want to know how WSAS is deployed). Step 1 Access WSAS management console using https://localhost:9443 and log in using default admin credentials (admin/admin). I'm going to explain how to secure one of the de...

The simplest method of deploying an Axis2 web service

I think Apache Axis2 is the most effective, efficient and useful open source java web service framework ever written. Not only that, if you are new to Java web services, Axis2 provides a lot of handy tools and mechanisms in order to start exploring WS technology. One of the easiest way of learning Axis2 is start with POJO (Plain old Java objects). You may wonder that you can deploy a java class as an Axis2 service in one line of code!!! Lets have a look... 1. Write a java class 2. Add following line inside the main method of your class new AxisServer().deployService(SimplePojo.class.getName()); Make sure to add Axis2 libraries in your class path. (Axis2-1.3 can be downloaded from here ) 3. Open your favorite browser and issue http://localhost:6060 4. You will see that your java class is exposed as an web service. Here is the complete sample code which can be copied to your IDE and play with it. package org.test; import org.apache.axis2.AxisFault; import org.apache.axis2.engine.AxisSer...

Exposing a spring bean as a web service

Image
One of the major requirements expected from a web service framework is to expose the existing business components as web services. Spring framework has been using for Enterprise Application development for many years as it provides a more simpler approach than traditional J2EE application development. WSO2 Web services application server provides an easy-to-use and efficient mechanism for exposing your Spring beans as java web service in a jiffy. Pre-requisites: WSO2 web services application server - WSAS2.2 ( Download ) Step 1 As the first step, we should implement the Spring class (pojo) which needs to be exposed as the web service. I will write a very simple pojo which has one In-Out method as follows. package org.ws.test; public class Inoutbean { public String echo(String s){ return s; } } Compile and save the class. Step 2 Now, we need to create the associated spring configuration file. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBL...