【问题标题】:Java: How can I view the XML that is sent and received by ServiceClient.sendReceive?Java:如何查看 ServiceClient.sendReceive 发送和接收的 XML?
【发布时间】:2013-05-22 08:02:09
【问题描述】:

我正在尝试调试使用axis2 使用.wsdl 文件访问SOAP API 时遇到的问题。我正在使用这种方法: http://axis.apache.org/axis2/java/core/api/org/apache/axis2/client/ServiceClient.html#sendReceive(org.apache.axiom.om.OMElement)

sendReceive 正在引发异常,我什至无法判断它是因为正在发送的内容还是因为服务器的响应。我希望能够看到发送和接收的 XML,但是我通过数据包嗅探找到它的尝试被 SSL 挫败了。具体来说,我得到的错误是:

SOAPProcessingException First Element must contain the local name, Envelope , but 
  found definitions  org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode 
  (StAXSOAPModelBuilder.java:299)

XMLStreamException Can not output XML declaration, after other output has 
already been done.  com.ctc.wstx.sw.BaseStreamWriter.throwOutputError (BaseStreamWriter.java:1473)

第一个错误让我认为我应该用 SOAPEnvelope 包装请求。当我这样做时,我得到第二个错误。我希望能够查看 XML,这样我就可以确切地知道消息发生了什么。

【问题讨论】:

    标签: java axis2


    【解决方案1】:

    如果您使用的是 Windows,请安装 Wireshark 并监控适配器上的流量以确定正在发送和接收的内容。在 Linux 上,阅读 tcpdump(8) 的手册页

    【讨论】:

    • 我使用 tcpdump 来获取发生的通信的转储,但它是加密的,所以我实际上看不到任何内容。
    猜你喜欢
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-16
    • 2015-11-12
    • 1970-01-01
    • 2013-06-07
    相关资源
    最近更新 更多