如何在使用 Axis 1.4 wsdl2java 生成的客户端时获取 SOAP 消息

发布于 2024-08-08 06:51:09 字数 426 浏览 4 评论 0原文

对于任何具有使用 Apache Axis 的 Web 服务的中等专业知识的人来说,这可能是一个简单的问题。

我有一个由 Axis 1.4 中的 wsdl2java 生成的 Web 服务客户端。我正在编写需要访问实际 SOAP 消息本身的单元测试,并与 Axis 生成的客户端 java 类进行比较。 (不要问)

如何从服务的响应中检索实际的 SOAP 消息?

根据我通过搜索得到的信息,我必须获取 MessageContext。 我已经尝试过一些类似的事情...

MessageContext mc = MessageContext.getCurrentContext(); 字符串消息 = mc.getCurrentMessage().getSOAPPartAsString();

但在这种情况下 mc 为空......

感谢任何帮助!

This is probably an easy question for anyone with any moderate expertise with web services using Apache Axis.

I have a web service client that was generated by wsdl2java in Axis 1.4. I am writing unit tests that need to access the actual SOAP message itself, and do a comparison to the client side java classes which are generated by Axis. (don't ask)

How can I retrieve the actual SOAP message from a response from the service?

From what I can gather from searching around is that I have to get the MessageContext.
I have tried something along these lines...

MessageContext mc = MessageContext.getCurrentContext();
String message = mc.getCurrentMessage().getSOAPPartAsString();

But mc is null in this case....

Any help is appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

睫毛上残留的泪 2024-08-15 06:51:09

_call 对象被填充时,调用下面的行给出它。

字符串请求=_call.getMessageContext().getRequestMessage()
.getSOAPPart().getEnvelope().toString();

对于响应,请使用以下一个

_call.getMessageContext().getResponseMessage()
如您所知,.getSOAPPart().getEnvelope().toString()

Call 是一个 org.apache.axis.client.Call

When _call object is filled calling the line below gives it.

String request=_call.getMessageContext().getRequestMessage()
.getSOAPPart().getEnvelope().toString();

For response use the below one

_call.getMessageContext().getResponseMessage()
.getSOAPPart().getEnvelope().toString()

Call is a org.apache.axis.client.Call as you know.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文