Oli,

The outMessage in this case is the outbound message currently being marshalled up *before* being sent. So your code will work before the request/response is sent.

For example on the client-side, ClientImpl.invoke() delegates to the binding to create the outMessage and sets this on the Exchange before traversing the intercpetor chain.

In fact, this sort of test is pretty much the approach used by the WS-A code to determine message direction (with a little added defensiveness against NPEs). See ContextUtils.isOutbound():

http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?view=co

/Eoghan


Wulff, Oliver wrote:
Hi there

I can check whether handleMessage is called in the context of inbound or 
outbound with the following lines:

boolean isOutbound = message == message.getExchange().getOutMessage()
               || message == message.getExchange().getOutFaultMessage();

But how can I check whether it's outbound in the context before the request is 
sent or a response is sent?

Thanks
Oliver


----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to