如何在使用 Axis 1.4 wsdl2java 生成的客户端时获取 SOAP 消息
对于任何具有使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就是这样完成的。
http://users.skynet.be/pascalbotte/rcx-ws-doc /jaxrpchandler.htm
This is how it's done.
http://users.skynet.be/pascalbotte/rcx-ws-doc/jaxrpchandler.htm
当
_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 aorg.apache.axis.client.Call
as you know.