2013-05-21 21 views
0

我想調試我使用axis2訪問使用.wsdl文件的SOAP API的問題。我正在使用這種方法: http://axis.apache.org/axis2/java/core/api/org/apache/axis2/client/ServiceClient.html#sendReceive(org.apache.axiom.om.OMElement)Java:如何查看由ServiceClient.sendReceive發送和接收的XML?

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,這樣我就可以確切地知道消息發生了什麼。

回答

0

如果您使用的是Windows,請安裝Wireshark並監視適配器上的流量以確定正在發送和接收的內容。在Linux上,請閱讀手冊頁tcpdump(8)

+0

我已經使用tcpdump來獲取發生的通信轉儲,但它被加密,所以我實際上看不到任何它。 – user2407310