用axis编写webservise客户端的问题(call对象的invoke方法)

错误提示:org.apache.axis.client.Callinvoke严重:Exception:org.xml.sax.SAXException:SimpleDes... 错误提示:
org.apache.axis.client.Call invoke
严重: Exception:
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:143)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1031)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:238)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
at org.apache.axis.client.Call.invoke(Call.java:2402)
at org.apache.axis.client.Call.invoke(Call.java:2301)
at org.apache.axis.client.Call.invoke(Call.java:1758)
at caClient.main(caClient.java:68)
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

源代码是这样的:
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class caClient {
public static void main(String[] args) {
try {
String endpoint = "http://www.webxml.com.cn/WebServices/StockInfoWS.asmx";
System.out.println("result is ");
Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress(endpoint);
call.setOperationName(new QName("http://www.webxml.com.cn/WebServices/StockInfoWS.asmx", "getStockInfo"));
call.addParameter("theStockCode",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("userID",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://webxml.com.cn/getStockInfo");
call.invoke(new Object[] { "sh000001","WebXml.com.cn" });
}
catch (Exception e) {
System.err.println(e);
}
}
}
最好实际调试一下小弟的代码, 提供正解后会有更多赏金 ^_^
展开
 我来答
百度网友41da067
2009-05-09 · TA获得超过192个赞
知道小有建树答主
回答量:294
采纳率:100%
帮助的人:194万
展开全部
看看下面这个,可能对你有帮助

参考资料: http://hi.baidu.com/shiliangshuai/blog/item/f5ad82d473b6ff00a08bb7ef.html

本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式