This looks like a bug...
I just checked the JaxWsMethodInvoker
try {
....
res = CastUtils.cast((List)super.invoke(exchange, serviceObject, m,
params));
//update the webservice response context
addHandlerProperties(ctx, handlerScopedStuff);
updateWebServiceContext(exchange, ctx);
} catch (Fault f) {
//get chance to copy over customer's header
updateHeader(exchange, ctx);
throw f;
} finally {
//clear the WebServiceContextImpl's ThreadLocal variable
WebServiceContextImpl.clear();
}
Thus, the addHandlerProperties call which adds the handler scoped properties
back into the context after the invoke is not being called for application
level faults. :-( I believe moving that into the finally shouldb e fine,
but I'll need to double check that.
Dan
On Wednesday 16 March 2011 5:13:50 AM drapanjanas wrote:
> Hi,
>
> Having trouble retrieving properties from LogicalMessageContext in
> handleFault(..) which were set in method handleMessage(..)
>
> I do smething like this:
> public boolean handleFault(LogicalMessageContext context) {
> String requestId = context.get(REQUEST_ID_KEY);
> return true;
> }
> public boolean handleMessage(LogicalMessageContext context) {
>
> if(Boolean.TRUE.equals(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY
> ))) {
> String requestId = context.get(REQUEST_ID_KEY);
> } else {
> String requestId = ... get from message payload ...
> context.put(REQUEST_ID_KEY, requestId);
> }
> return true;
> }
>
> In case of operation fault from my webservice i get null for requestId, but
> in case of successful response i get it same as was set.
> And in case of ProtocolException is thrown in deeper handlers in the chain
> - then i get requestId as expected in handleFault.
>
> Have someone faced similar issue with MesageContext properties? I'm using
> CXF version 2.2.2
> Please help.
> Thanks.
> BR,
> Arturas Girenko
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/LogicalMessageContext-in-handleFault-does-
> not-contain-properties-set-in-handleMessage-tp3772342p3772342.html Sent
> from the cxf-user mailing list archive at Nabble.com.
--
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com