http://docs.oracle.com/javaee/5/api/javax/xml/ws/handler/soap/SOAPHandler.html
如何将入站 handleMessage(SOAPMessageContext)
调用与出站 handleMessage(SOAPMessageContext)
关联起来。
我尝试了一些方法,Weblogic 不重用上下文对象,因此引用检查不起作用。我找不到任何明确指示请求的属性,因此我似乎无法在请求和响应之间创建链接。
或者是否有更好的方法来获取有问题的 Web 逻辑上的请求和响应并将其关联在一起,以便可以将它们转储到数据库以供将来调试之用。
最佳答案
好吧,这可能不适用于 JAX-WS 的所有实现,但对于 weblogic 来说确实如此。
我做了什么
public final boolean handleMessage(SOAPMessageContext context) {
// Using `Object` type as we don't have any need to import servlet libraries into a JAX-WS library
Object o = context.get(MessageContext.SERVLET_REQUEST);
// o will hold a reference to the request
// if inbound.o == outbound.o the request objects are identical and therefor we can associate them.
return true;
}
我不明白为什么这在其他容器中不起作用,但请在使用此方法之前仔细检查。
关于java - 如何将入站和出站 SOAP 处理程序相互关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14821706/