Click here to Skip to main content
Click here to Skip to main content

Consuming a .NET Web Service with Apache AXIS

, 15 Apr 2004 Apache
Rate this:
Please Sign up or sign in to vote.
Consuming a .NET Web Service with Apache AXIS.


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" %>
using System;
using System.Web.Services;
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:

package org.tempuri;
public class Client
      public static void main(String [] args)
                  HelloWorldLocator loc = new HelloWorldLocator();
                  HelloWorldSoap port = loc.getHelloWorldSoap();
            catch(Exception e)

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.


This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


About the Author

Fahad Azeem
Web Developer
United States United States
My name is Fahad Azeem. I am interested in distributed software development. Currently I am working for a software consulting company in Chicago which developes software in .NET platform.
My Blog:

Comments and Discussions

Generalhoe to pass user credentials Pinmembera_s_a23-May-06 20:42 
GeneralRe: how to pass user credentials PinmemberFahad Azeem25-May-06 5:00 
GeneralProblem with axis.jar PinmemberGowtam Kamath22-May-06 20:17 
GeneralRe: Problem with axis.jar PinmemberFahad Azeem23-May-06 12:59 
GeneralRe: Problem with axis.jar PinmemberGowtam Kamath23-May-06 20:41 
GeneralRe: Problem with axis.jar PinmemberRameshtcs18-Jan-07 18:15 
GeneralRe: Problem with axis.jar Pinmembersonal_hotmail29-May-08 2:03 
Generalthe other way around Pinmemberoxygen_fiend18-May-06 19:28 
how do you consume a webservice in axis in .NET
GeneralRe: the other way around PinmemberFahad Azeem19-May-06 4:39 
GeneralRe: the other way around Pinmemberoxygen_fiend19-May-06 15:03 
GeneralRe: the other way around PinmemberFahad Azeem19-May-06 17:34 
GeneralRe: the other way around Pinmemberoxygen_fiend19-May-06 17:47 
GeneralRe: the other way around PinmemberEdwinY7-Aug-08 0:43 
QuestionError thrown parsing asmx page? PinmemberJesse W. Reno23-Feb-06 13:54 
AnswerRe: Error thrown parsing asmx page? PinmemberFahad Azeem24-Feb-06 15:20 
GeneralRe: Error thrown parsing asmx page? Pinmemberaaazzzdddd17-Sep-07 3:37 
GeneralGetting this error PinmemberMuhammad Irfan Azam21-Feb-06 23:57 
GeneralRe: Getting this error PinmemberFahad Azeem24-Feb-06 15:19 
GeneralThanks for the information PinmemberWillemM18-Jan-06 9:30 
GeneralRe: Thanks for the information PinmemberFahad Azeem20-Jan-06 8:43 
Generalwsdl2java PinmemberRanganaths18-Jan-06 8:01 
GeneralRe: wsdl2java PinmemberFahad Azeem20-Jan-06 8:41 
QuestionConnections on server not closed Pinmemberpschrot9-Dec-05 3:32 
QuestionSSL connection with Apache Axis Pinmemberwouter devers19-Nov-05 5:53 
AnswerRe: SSL connection with Apache Axis PinmemberFahad Azeem21-Nov-05 10:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 16 Apr 2004
Article Copyright 2004 by Fahad Azeem
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid