Invocationctx.Getcontextdata() Does Not Include Webservicecontext Parameters (Doc ID 1408723.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle Weblogic Server - Version: 10.3.3 and later   [Release: and later ]
Information in this document applies to any platform.

Symptoms

An EJB  method  is called as a web service in 10.3.3 WLS.
EJB interceptor mechanism  is used to intercept this  EJB method call.

When intercepting this method call, the following code is executed :
public class MyInterceptor {
@Resource
WebServiceContext wsContext;
/*
* The method called at the @AroundInvoke aspect to intercept the orginal
* Service Request.
*/
@AroundInvoke
public Object intercept(InvocationContext invocationCtx) throws Exception
{
 String ctxValue = (String)invocationCtx.getContextData().get("KEY");
 String wsValue = (String)wsContext.getMessageContext().get("KEY");

 return "From intercept: Value from invocationCtx: " +
         ctxValue +
         ". Value from wsContext: " + wsValue;
}
}


The  invocationCtx.getContextData("KEY") method returns  NULL .
And,  wsContext.getMessageContext().get("KEY") returns a non NULL value

Referring to EJB 3.0 core specification (section 12.5 InvocationContext) :

'If interceptors are invoked as a result of the invocation on a web service
endpoint, the map returned by getContextData will be the JAX-WS
MessageContext [32].'

Therefore,  if s wsContext().get("KEY")  returns a non NULL value,  invocationCtx.getContextData("KEY") should return the same  non NULL value.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms