axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nirmit Desai <nirde...@us.ibm.com>
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
services.xml).
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:
http://www.developer.com/open/print.php/10930_3589126_3

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

Thanks,

-Nirmit




                                                                           
             "David Illsley"                                               
             <davidillsley@gma                                             
             il.com>                                                    To 
                                       axis-user@ws.apache.org             
             08/01/2006 12:16                                           cc 
             PM                                                            
                                                                   Subject 
                                       Re: [Axis2 1.0] MessageContext is   
             Please respond to         null                                
             axis-user@ws.apac                                             
                  he.org                                                   
                                                                           
                                                                           
                                                                           
                                                                           




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,
David

On 01/08/06, Nirmit Desai <nirdesai@us.ibm.com> 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
throw
> 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
this
> 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: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


--
David Illsley - IBM Web Services Development

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message