web-services – org.apache.axis2.AxisFault:First Element必须包含本地名称Envelope,但找到定义

前端之家收集整理的这篇文章主要介绍了web-services – org.apache.axis2.AxisFault:First Element必须包含本地名称Envelope,但找到定义前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
请求在我的本地环境中正常工作,并且在部署的环境中不起作用.来自包括soapui在内的各种客户尝试了请求.代码部署在WAS上

Axis2的

  1. org.apache.axis2.AxisFault: First Element must contain the local name,Envelope,but found definitions
  2. at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
  3. at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123)
  4. at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
  5. at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
  6. at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
  7. at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
  8. at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
  9. at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
  10. Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name,but found definitions
  11. at java.lang.Throwable.<init>(Throwable.java:67)

解决方法

这是服务器未返回预期的xml响应格式的问题.这可能是由使用不正确的服务端点URL引起的.

解决此问题,请确保Axis代码中使用的URL与代码所基于的WSDL中的端点的URL相匹配.

WSDL中的位置:

  1. <service name="ServiceName">
  2. <port name="PortName" binding="typens:PortNameBinding">
  3. <soap:address location="http://yourdomain.com/api/soap/"/>
  4. </port>
  5. </service>

代码中的相应位置通常位于两个位置的ServiceNameStub类中:

  1. /**
  2. * Default Constructor
  3. */
  4. public ServiceNameStub(
  5. org.apache.axis2.context.ConfigurationContext configurationContext)
  6. throws org.apache.axis2.AxisFault {
  7.  
  8. this(configurationContext,"http://yourdomain.com/api/soap/");
  9.  
  10. }
  11.  
  12. /**
  13. * Default Constructor
  14. */
  15. public ServiceNameStub() throws org.apache.axis2.AxisFault {
  16.  
  17. this("http://yourdomain.com/api/soap/");
  18.  
  19. }

只需确保这两个URL与您在WSDL文件中的服务端口的soap:address处找到的URL匹配.

猜你在找的HTML相关文章