我如何将入站和出站肥皂处理程序相互关联 [英] How can I associate and inbound and outbound soaphandler with each-other
问题描述
http://docs.oracle.com/javaee/5/api/javax/xml/ws/handler/soap/SOAPHandler.html
如何将入站 handleMessage(SOAPMessageContext)
调用与出站 handleMessage(SOAPMessageContext)
相关联.
How can I associate an inbound handleMessage(SOAPMessageContext)
call with and outbound handleMessage(SOAPMessageContext)
.
我尝试了一些方法,Weblogic 不重用上下文对象,因此引用检查不起作用.我找不到任何明确指示请求的属性,因此我似乎无法在请求和响应之间创建链接.
I've tried a few things, Weblogic doesn't reuse the context object so reference checking doesn't work. I can't find any property that indicates the request distinctly and therefor I can't seem to create a link between the request and response.
或者,有没有更好的方法可以在网络逻辑上有问题地获取请求和响应并将它们关联在一起,以便将它们转储到数据库中以备将来调试.
Alternatively is there a better way to get the request and response on web-logic problematically and associated together such that they can be dumped to the database for future debugging purposes.
推荐答案
好的,所以这可能不适用于 JAX-WS 的所有实现,但对于 weblogic 这肯定适用.
Okay, so this may not work on all implementations of JAX-WS but for weblogic this certainly does.
我做了什么
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;
}
我不明白为什么这在其他容器中不起作用,但请在使用此方法之前仔细检查.
I don't see why this wouldn't work in other containers but please double check before using this method.
这篇关于我如何将入站和出站肥皂处理程序相互关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!