Consuming External Web Services through Java Client Using Apache Axis

Posted on 2007-10-18
Last Modified: 2008-09-01
Dear Expert,

I am very new in web services.

I want to create a java client to consume external web services using apache axis.

My web services are deployed on this location (

Can you please give me a java code. In which I can consume all the deployed web services?

Don't give me an apache examples. Please do write exact code.

This is what I have done till now.

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;

public class GetProduct
   public static void main(String [] args) throws Exception
       Service service = new Service();
       Call call = (Call)service.createCall();

       String endpoint = "";
       call.setTargetEndpointAddress(new URL(endpoint));  
       call.setOperationName(new QName("GetProduct"));

       String productId = args[0];
       String result = (String)call.invoke("","GetProduct",new Object [] {new String(productId)});
       System.out.println("Got Product : ");

its compiling but when I am trying to run by passing ProductID given below.

 C:\Jdk_1.6\src>java GetProduct 6696E2E0-FF4D-4BEA-8286-3851E256A49D

its giving error saying

- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
- Exception:
org.xml.sax.SAXException: Deserializing parameter 'GetProductResult':  could not find deserializer for type {}ErrorView
      at org.apache.axis.message.RPCHandler.onStartChild(
      at org.apache.axis.encoding.DeserializationContext.startElement(
      at org.apache.axis.message.SAX2EventRecorder.replay(
      at org.apache.axis.message.MessageElement.publishToHandler(
      at org.apache.axis.message.RPCElement.deserialize(
      at org.apache.axis.message.RPCElement.getParams(
      at org.apache.axis.client.Call.invoke(
      at org.apache.axis.client.Call.invoke(
      at GetProduct.main(

For your kind information, GetProduct() is web service deployed on the given link.

Question by:dinesh_bali

    Author Comment


    I am waiting for your response on my question.

    Its very urgent!!

    Please take my question on priority. Otherwise it is type of wasting money.

    LVL 9

    Accepted Solution

    you can use wsdl2java to create required class and so you can easily call any service.

    for more info;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    Title # Comments Views Activity
    fix34  challenge 9 70
    wordsWithoutList  challenge 24 61
    dividesSelf challange 15 57
    java  and programming certification ? 4 28
    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now