axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nirmit Desai <>
Subject Re: [Axis2 1.0] MessageContext is null
Date Tue, 01 Aug 2006 17:21:28 GMT
Hi David,

Thanks a lot for your help. I used setOperationContext and it worked.

I am accessing a service level parameter (defined at deployment time in
However, the message receiver would call setOperationContext every time an
operation is being invoked, and if I am understanding this right, all the
message contexts extracted from these calls would contain the service level
parameters. So I just need to store any one of the message contexts to
access the parameter from service methods.

AXIS2 documentation needs to be updated:

The above famous article (and some older posts) advised me to use



             "David Illsley"                                               
   >                                                    To 
             08/01/2006 12:16                                           cc 
                                       Re: [Axis2 1.0] MessageContext is   
             Please respond to         null                                

OK, so I'm a little familiar with this code and there are a couple of
relevant things:

1. it should be init(ServiceContext sc) not MessageContext which may
be why init isn't being called. You may be able to get what you want
from the ServiceContext depending on what you're looking for.

2. DependencyManager.configureBusinessLogicProvider causes
setOperationContext(OperationContext oc) to be called on the
implementation class if it exists. From this you gan get the
associated MessageContext(s).

Hope that helps,

On 01/08/06, Nirmit Desai <> wrote:
> Hi all,
> I have generated my implementation class from a WSDL and added the
> following method:
> private MessageContext msgCtx=null;
> public void init(MessageContext ctx){
>       msgCtx=ctx;
>       System.out.println("init called..context:"+ctx);
> }
> But, the init method is never called!! (I checked the service logs for
> output, and I see other System outs). Due to that the service methods
> a null pointer exception when trying to access msgCtx.
> I read somewhere that a MessageReceiver is supposed to call the init
> method. WSDL2Java generates a custom message receiver for every service
> (Axis Data binding). I looked inside my message receiver and it does not
> seem to be making any calls before calling the service methods except
> one:
> //Inject the Message Context if it is asked for
> org.apache.axis2.engine.DependencyManager.configureBusinessLogicProvider
> (obj, msgContext.getOperationContext());
> Any clues why init is not being called?
> Thanks,
> -Nirmit
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

David Illsley - IBM Web Services Development

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message