This is driving me Nuts totally... I am using Axis client to invoke a remotely hosted web-service at XMethods. I've been sitting on this problem for the past 10 days .....still no clue on it....
================================================================================ Here is my classpath setting:
import org.apache.axis.client.Call; import javax.xml.namespace.QName; public class TemperatureServiceMain2 { public static void main(String[] args) throws Exception {
Call call = new Call("http://services.xmethods.net:80/soap/servlet/rpcrouter");
// Set the name of the operation to call (from the portType in the WSDL) // Note that we need to specify the namespace of the operation, // also gleaned from the WSDL call.setOperationName(new QName("urn:xmethods-Temperature", "getTemp"));
String zipCode = "19147"; // Zip code for Philadelphia // Call the Web Service, passing the parameter as an array of Objects // Similarly, the return value is a plain Object Object ret = call.invoke(new Object[]{zipCode});
// Cast the return value to the correct type float temp = ((Float)ret).floatValue(); System.out.println("The temperature at " + zipCode + " is " + temp); } }
================================================================================== Here is what happens when I run the code: ================================================================================ C:\Soap>java TemperatureServiceMain2 log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR esourceBundle). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client faultSubcode: faultString: No Deserializer found to deserialize a 'http://schemas.xmlsoap.org /soap/encoding/:string' using encoding style 'http://schemas.xmlsoap.org/soap/en coding/'. faultActor: /soap/servlet/rpcrouter faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:No Deserializer found to deseria lize a 'http://schemas.xmlsoap.org/soap/encoding/:string' using encoding style ' http://schemas.xmlsoap.org/soap/encoding/'. at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder .java:221) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder. java:128) at org.apache.axis.encoding.DeserializationContext.endElement(Deserializ ationContext.java:1087) at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source) at org.apache.crimson.parser.Parser2.content(Unknown Source) at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source) at org.apache.crimson.parser.Parser2.content(Unknown Source) at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source) at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source) at org.apache.crimson.parser.Parser2.parse(Unknown Source) at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at org.apache.axis.encoding.DeserializationContext.parse(Deserialization Context.java:227) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696) at org.apache.axis.Message.getSOAPEnvelope(Message.java:424) at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.j ava:745) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:141)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg y.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2754) at org.apache.axis.client.Call.invoke(Call.java:2737) at org.apache.axis.client.Call.invoke(Call.java:2413) at org.apache.axis.client.Call.invoke(Call.java:2336) at org.apache.axis.client.Call.invoke(Call.java:1793) at TemperatureServiceMain2.main(TemperatureServiceMain2.java:20)
No Deserializer found to deserialize a 'http://schemas.xmlsoap.org/soap/encoding /:string' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'. at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder .java:221) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder. java:128) at org.apache.axis.encoding.DeserializationContext.endElement(Deserializ ationContext.java:1087) at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source) at org.apache.crimson.parser.Parser2.content(Unknown Source) at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source) at org.apache.crimson.parser.Parser2.content(Unknown Source) at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source) at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source) at org.apache.crimson.parser.Parser2.parse(Unknown Source) at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at org.apache.axis.encoding.DeserializationContext.parse(Deserialization Context.java:227) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696) at org.apache.axis.Message.getSOAPEnvelope(Message.java:424) at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.j ava:745) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:141)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg y.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2754) at org.apache.axis.client.Call.invoke(Call.java:2737) at org.apache.axis.client.Call.invoke(Call.java:2413) at org.apache.axis.client.Call.invoke(Call.java:2336) at org.apache.axis.client.Call.invoke(Call.java:1793) at TemperatureServiceMain2.main(TemperatureServiceMain2.java:20)
I am using the Latest version of apache Axis 1.2 Here is what my classpath setting look like :
set classpath=.;C:\mail.jar;C:\activation.jar;C:\Axis\axis-1_2\lib\axis.jar;C:\Axis\axis-1_2\lib\commons-discovery-0.2.jar;C:\Axis\axis-1_2\lib\commons-logging-1.0.4.jar;C:\Axis\axis-1_2\lib\jaxrpc.jar;C:\Axis\axis-1_2\lib\log4j-1.2.8.jar;C:\Axis\axis-1_2\lib\wsdl4j-1.5.1.jar;C:\Axis\axis-1_2\lib\saaj.jar;
ANyone answers ???
Ashutosh Shahi
Ranch Hand
Joined: Feb 06, 2005
Posts: 36
posted
0
Did u see if the service at xmethods is doc/lit or rpc/encoded? Axis call() method puts rpc/encoded by default, so if the service is doc/lit, u'll have to set style n use to document literal. -Ashutosh