java - 如何查看Axis2发送和接收的内容?

标签 java http web-services apache-axis axis

我已经 Axis2 创建了 Web 服务客户端。该服务同时使用 SSL 和 WS-Security,因此我使用 rampart。我认为我的客户发送了正确的查询,但我遇到了异常:

org.apache.axis2.AxisFault: Must Understand check failed for header http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd : Security
at org.apache.axis2.engine.AxisEngine.checkMustUnderstand(AxisEngine.java:97)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:364)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at pl.firstdata.www.wdx.business.card.CardServiceStub.getBalance(CardServiceStub.java:1570)
at pl.firstdata.www.wdx.business.card.wdx_client.main(wdx_client.java:164)

有什么方法可以查看带有 HTTP header 的“裸”查询和响应吗?

虽然此服务使用 SSL,但我认为我无法使用 HTTP 监视器,这应该由 axis2 在“应用”WS-Security 之后但在 SSL 之前完成。我可以在我的模拟器上启用此类日志记录(无需 SSL),看起来像这样:

POST /webservices/emu/get_info.hdb HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: ""
User-Agent: Axis2
Host: 127.0.0.1:8765
Content-Length: 4585

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1"><xenc:EncryptedKey Id="EncKeyId-0D71FF61F3796881F812803190645315"><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" /><ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<wsse:SecurityTokenReference><wsse:KeyIdentifier ...
...

最佳答案

为此使用 tcpmon 工具。

请注意,在大多数基于 Linux 的安装中,这很可能是为您构建的。完成构建过程后,您可以在 Linux 上的 ${AXIS2C_HOME}/bin/tools 或 MS Windows 上的 %AXIS2C_HOME%\bin\tools 中找到可执行文件。

关于java - 如何查看Axis2发送和接收的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3360595/

相关文章:

java - 如何在 Java 中实现树形数据结构?

http - 是否可以在 Go 中将代理/ socks 与 http2 客户端一起使用?

c# - 将查询字符串添加到 REST GET

wcf - 如何从 Web 服务中获取异常?

java - 连接到 Android 的 php 文件

java - 使用 Scribe 构建 oauth 登录

html - 如果有小的副作用,可以使用 HTTP GET 吗?

Java Web 服务 tomcat 无法找到共享库

java - 如何使用正则表达式检查 Java 中有效的 html 结构

http - 服务器日志中的奇怪查询 REMOTE HI_SRDK_DEV_GetHddInfo