Hello Guys .....
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:
C:\Soap>set
classpath=.;D:\Tomcat\webapps\axis\WEB-INF\lib\axis.jar;D:\Tomcat\we
bapps\axis\WEB-INF\lib\commons-discovery.jar;D:\Tomcat\webapps\axis\WEB-INF\lib\
commons-logging.jar;D:\Tomcat\webapps\axis\WEB-INF\lib\jaxrpc.jar;D:\Tomcat\weba
pps\axis\WEB-INF\lib\saaj.jar;D:\Tomcat\webapps\axis\WEB-INF\lib\log4j-1.2.8.jar
;C:\activation.jar;C:\mail.jar;
================================================================================
Here is my code:
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)
{http://xml.apache.org/axis/}hostname:ISGDNARASIMAXP
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)
C:\Soap>
--
Using Opera's revolutionary e-mail client:
http://www.opera.com/m2/