dinesh_bali
asked on
Consuming External Web Services through Java Client Using Apache Axis
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.Cal l;
import org.apache.axis.client.Ser vice;
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.setTargetEndpointAddr ess(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/","Ge tProduct", 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-38 51E256A49D
its giving error saying
- Unable to find required classes (javax.activation.DataHand ler and javax.mail.internet.MimeMu ltipart). 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.RP CHandler.o nStartChil d(RPCHandl er.java:27 7)
at org.apache.axis.encoding.D eserializa tionContex t.startEle ment(Deser ialization Context.ja va:1035)
at org.apache.axis.message.SA X2EventRec order.repl ay(SAX2Eve ntRecorder .java:165)
at org.apache.axis.message.Me ssageEleme nt.publish ToHandler( MessageEle ment.java: 1141)
at org.apache.axis.message.RP CElement.d eserialize (RPCElemen t.java:345 )
at org.apache.axis.message.RP CElement.g etParams(R PCElement. java:384)
at org.apache.axis.client.Cal l.invoke(C all.java:2 467)
at org.apache.axis.client.Cal l.invoke(C all.java:2 366)
at GetProduct.main(GetProduct .java:25)
For your kind information, GetProduct() is web service deployed on the given link.
Thanks
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.Cal
import org.apache.axis.client.Ser
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.setTargetEndpointAddr
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/","Ge
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-38
its giving error saying
- Unable to find required classes (javax.activation.DataHand
- 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.RP
at org.apache.axis.encoding.D
at org.apache.axis.message.SA
at org.apache.axis.message.Me
at org.apache.axis.message.RP
at org.apache.axis.message.RP
at org.apache.axis.client.Cal
at org.apache.axis.client.Cal
at GetProduct.main(GetProduct
For your kind information, GetProduct() is web service deployed on the given link.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Thanks.