Advertisement

10.18.2007 at 07:06AM PDT, ID: 22901726
[x]
Attachment Details

Consuming External Web Services through Java Client Using Apache Axis

Asked by dinesh_bali in Java Programming Language

Tags: axis, java, web, consume

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 (http://test.gateway.englandnet.co.uk/IOGatewayWebService/ProductService.asmx).

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;
import java.net.*;

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

       String endpoint = "http://test.gateway.englandnet.co.uk/IOGatewayWebService/ProductService.asmx";
       
       call.setTargetEndpointAddress(new URL(endpoint));  
             
       call.setSOAPActionURI("http://gateway.englandnet.co.uk/IOGatewayWebservice/GetProduct");
             
       call.setOperationName(new QName("GetProduct"));

       String productId = args[0];
           
       String result = (String)call.invoke("http://gateway.englandnet.co.uk/IOGatewayWebservice/","GetProduct",new Object [] {new String(productId)});
       
       System.out.println("Got Product : ");
       System.out.println(result);        
   }
}

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 {http://gateway.englandnet.co.uk/IOGatewayWebservice/}ErrorView
      at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
      at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
      at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
      at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
      at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
      at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
      at org.apache.axis.client.Call.invoke(Call.java:2467)
      at org.apache.axis.client.Call.invoke(Call.java:2366)
      at GetProduct.main(GetProduct.java:25)

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

Thanks
 Start Free Trial
[+][-]10.19.2007 at 12:47AM PDT, ID: 20107179

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.21.2007 at 10:41PM PDT, ID: 20121021

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Tags: axis, java, web, consume
Sign Up Now!
Solution Provided By: ysnky
Participating Experts: 1
Solution Grade: A
 
 
[+][-]08.28.2008 at 12:37PM PDT, ID: 22338917

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.01.2008 at 07:18AM PDT, ID: 22360587

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628