当前位置:编程学习 > C#/ASP.NET >>

调用webservice的时候报错,哪位帮忙看一下什么原因.

我是用axix1.4-2的包,  wsdl2java 来生成的客户端和服务端的类,然后把服务部署到tomcat后,从客户端发起调用,这个协议我只定义了一个参数.然后我写了个调用的主函数,如下:
public class DeliveryClient {
 public static void main(String[] args){
  try{
   String url = "http://localhost:8080/axis2/services/Test";
   TestStub stub = new TestStub(null,url);
   
   org.apache.ws.axis2.services.test.types.TestRequestDocument request = org.apache.ws.axis2.services.test.types.TestRequestDocument.Factory.newInstance();
   
   org.apache.ws.axis2.services.test.types.TestRequestDocument.TestRequest req=  request.addNewTestRequest();
   req.setEventID("00001");
  
  
   request.setTestRequest(req);
   
   
   
   //TestCallbackHandler callback=null;
   
   //stub.startTestRequest(request, callback);
   
   org.apache.ws.axis2.services.test.types.TestRequestResponseDocument   reponse = stub.TestRequest(request);
   
   org.apache.ws.axis2.services.test.types.TestRequestResponseDocument.TestRequestResponse  rep=reponse.getTestRequestResponse();
   
   System.out.println(rep.getEventID());
   
   
   
  }catch(Exception ex){
   ex.printStackTrace();
  }
 }

然后在执行的时候,执行到stub.TestRequest(request);
报错了:
[ERROR] org.apache.xmlbeans.impl.values.XmlComplexContentImpl
org.apache.axis2.AxisFault: org.apache.xmlbeans.impl.values.XmlComplexContentImpl
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.ws.axis2.services.test.TestMessageReceiverInOut.fromOM(TestMessageReceiverInOut.java:258)
at org.apache.ws.axis2.services.test.TestMessageReceiverInOut.invokeBusinessLogic(TestMessageReceiverInOut.java:44)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: org.apache.xmlbeans.impl.values.XmlComplexContentImpl
at org.apache.ws.axis2.services.test.types.TestRequestDocument$Factory.parse(TestRequestDocument.java:130)
at org.apache.ws.axis2.services.test.TestMessageReceiverInOut.fromOM(TestMessageReceiverInOut.java:238)
... 20 more

}
是哪里的问题呢?是协议类型定义的问题还是接口实现的方法有问题?请大侠帮忙指点一下.
--------------------编程问答-------------------- 这里有个例子,你可以下载对比一下
http://hi.csdn.net/link.php?url=http://zx27600.download.csdn.net
补充:.NET技术 ,  Web Services
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,