本文介绍了将对象从 SOAP 处理程序发送到 Web 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将对象从 SOAP 处理程序发送到 Web 服务?我知道我可以修改 SOAP 消息,但我正在尝试将整个 SOAP 消息发回.在 Web 服务中,我无权访问 SOAP 信封.此外,这是实现 wsdl 并且我无法更改作为特定类型 XML 的参数类型.因此,我正在考虑在 SOAP 处理程序和 Web 服务之间使用某种并行消息传递机制.
How can I send an Object from a SOAP Handler to the web service? I know I can modify the SOAP message but I'm trying to send the whole SOAP message back. In the web service I don't have access to the SOAP envelope. Also, this is implementing a wsdl and I can't change the parameter type which is a particular kind of XML. So I'm thinking of using some kind of parallel messaging mechanism between the SOAP Handler and the web service.
推荐答案
在 SOAP 处理程序中,
In the SOAP Handler,
public boolean handleMessage(SOAPMessageContext mc) {
...
ByteArrayOutputStream out = new ByteArrayOutputStream();
SOAPMessage soapMsg = mc.getMessage();
mc.put("soapMsg", out);
mc.setScope("soapMsg", MessageContext.Scope.APPLICATION);
...
}
在网络服务中:
MessageContext messageCtx = context.getMessageContext();
String doc = (messageCtx.get("soapMsg")).toString();
这篇关于将对象从 SOAP 处理程序发送到 Web 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!