In this article, I will present an example on how to develop a typical HelloWorld Web Service with .NET on IIS, and how to consume that service with Apache AXIS in Java. Apache AXIS is SOAP implementation provided by Apache. AXIS SOAP implementation is available in two languages, C++ and Java. In this article, I will use the Java implementation of AXIS SOAP. Apache AXIS can be downloaded from here.
HelloWorld.asmx file is a simple text file in C#. The class
HelloWorld just extends with the class
WebService and implements a method
SayHelloWorld(). To make this method a web method, it is given the attributed
[WebMethod]. IIS simply takes care of generating the SOAP message and the WSDL file for the client.
Web Service on IIS in .asmx file
<%@ WebService Language="C#" Class="HelloWorld" %>
public class HelloWorld : WebService
[WebMethod] public String SayHelloWorld()
return "Hello World";
To consume this Web Service with AXIS, WSDL file for the HelloWorld Web Service needs to be downloaded.
Now, to consume this Web Service, Apache AXIS provides a tool WSDL2Java to convert WSDL specification file to Java code. This tool generates the four Java classes, and that will take care of processing XML and SOAP messaging, and makes the use of Web Service as simple as calling an object on a local machine.
> java org.apache.axis.wsdl.WSDL2Java <A href="http://localhost/HelloWorld.asmx?WSDL">http://localhost/HelloWorld.asmx?WSDL</A>
The above tool will generate the following four class files which can be used to access that Web Service.
This is how the client program looks like:
public class Client
public static void main(String  args)
HelloWorldLocator loc = new HelloWorldLocator();
HelloWorldSoap port = loc.getHelloWorldSoap();
Before coming across Apache AXIS, my reaction to developing and consuming Web Service in Java was that it was a lot of pain. But with Apache AXIS, developing and consuming Web Service is as simple as in .NET platform.