You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Gopal Patwa <go...@gmail.com> on 2006/04/10 07:48:32 UTC

Small changing in Service implementation class

I  am wondering does below propose from Deepal change is included in axis2
1.0 RC1. 

I had init method in my service implementation class to get access SOAP
header from MessageContext to read ws-addressing information but after
migrating to 1.0RC1 my msgContext is always null, does this method still
support or there is method signature change.

 public void init(MessageContext msgContext) {
        this.msgContext = msgContext;
    }

===============================================

Previous mail from Deepal, I am posting this message for reference couldn't
find the thread .

Hi all;

To support the scenario describe by the JIRA
http://issues.apache.org/jira/browse/AXIS2-341 , it is require to do
small changes into service implementation class.

   In the current code base in order to get access to message context he
has to add init method , and if the init method is present , it will
call for each and every invocation. (init method can take one message
context or two message context). I propose to change that to get
operation context instead of message context and rename method to  
    setOperationContext(OperationContext opctx);


When the session get start up , the init() method of the service class
will be called (using reflection) if it is present. And method will be
given the serviceContext corresponds to that service.

    init(ServiceContext serviceCtx)

When the session get invalidate destroy method of the service impl class
will be called if it present giving ServiceContext as argument.

  destroy(ServiceContext serviceCtx);

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 
--
View this message in context: http://www.nabble.com/Small-changing-in-Service-implementation-class-t1423137.html#a3836353
Sent from the Axis - User forum at Nabble.com.


Re: [Axis2 1.0RC1] Problem getting MessageContext in ServiceImpl class

Posted by Deepal Jayasinghe <de...@opensource.lk>.
We introduced new concept of runing client inside a server :) , so what
that mean is any client running inside (say tomcat) a server can access
server's configurationContext , the advantage of this is client can use
server listeners and server properties if it requires. So in your case
when you are creating ServiceClient you have to pass a configcontext ,
and if you set that configconetx as

ListenerManager.defaultConfigurationContext

then you no longer get that exception.

Gopal Patwa wrote:

>let me clear couple of things, even if my service runing in tomcat with
>axis2 webapp with addressing module engage globaly but if my service Impl
>class uses ServiceClient class to call BPEL process does it will be running
>in different environment.
>
>here is scenario,
>
>I have an asynchronous echo service which uses ServiceClient to Callback
>BPEL after some time when process is done and everything is running in
>server under tomcat.
>
>Only for debugging I am running tomcat in debug mode in eclipse to step
>through my service which deployed on tomcat server.
>
>Still my code will run in different environment if it uses ServiceClient
>class.??
>
>Thanks for reply Chinthaka.
>
>
>
>Eran Chinthaka wrote:
>  
>
>>Gopal Patwa wrote:
>>    
>>
>>>Thanks Chinthaka, It work now but I have some other problem.
>>>
>>>I have wrote axis2 asynchronous service to work with BPEL. When I am
>>>trying
>>>to call BPEL service while to engaging addressing module
>>>
>>>            ServiceClient sender = new ServiceClient();
>>>            sender.engageModule(new QName(Constants.MODULE_ADDRESSING));
>>>
>>>Note: this code run on tomcat 5.5  not from some java client
>>>
>>>I get module not found, since my service is deployed in tomcat 5.5 with
>>>axis
>>>1.0RC1 webapp and globally engage addressing module which I can see from
>>>admin page.
>>>      
>>>
>>You have engaged addressing in server side. Client is running in a
>>different environment.
>>
>>    
>>
>>>Do I need to engage addressing module for ServiceClient even I have
>>>globally
>>>set for all service
>>>
>>>When I am debugging my service in eclipse 3.1, I see error module not
>>>found
>>>?? after this line of code
>>>
>>>            sender.engageModule(new QName(Constants.MODULE_ADDRESSING));
>>>
>>> any idea why it is happening
>>>      
>>>
>>Hmm, it seems I better update the FAQ abt this.
>>
>>When you run your client, try putting addressing-<version>.mar in your
>>classpath.
>>
>>-- Chinthaka
>>
>>
>>
>>    
>>
>--
>View this message in context: http://www.nabble.com/-Axis2-1.0RC1-Problem-getting-MessageContext-in-ServiceImpl-class-t1423137.html#a3875656
>Sent from the Axis - User forum at Nabble.com.
>
>
>
>  
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 



Re: [Axis2 1.0RC1] Problem getting MessageContext in ServiceImpl class

Posted by Gopal Patwa <go...@gmail.com>.

let me clear couple of things, even if my service runing in tomcat with
axis2 webapp with addressing module engage globaly but if my service Impl
class uses ServiceClient class to call BPEL process does it will be running
in different environment.

here is scenario,

I have an asynchronous echo service which uses ServiceClient to Callback
BPEL after some time when process is done and everything is running in
server under tomcat.

Only for debugging I am running tomcat in debug mode in eclipse to step
through my service which deployed on tomcat server.

Still my code will run in different environment if it uses ServiceClient
class.??

Thanks for reply Chinthaka.



Eran Chinthaka wrote:
> 
> Gopal Patwa wrote:
>> Thanks Chinthaka, It work now but I have some other problem.
>> 
>> I have wrote axis2 asynchronous service to work with BPEL. When I am
>> trying
>> to call BPEL service while to engaging addressing module
>> 
>>             ServiceClient sender = new ServiceClient();
>>             sender.engageModule(new QName(Constants.MODULE_ADDRESSING));
>> 
>> Note: this code run on tomcat 5.5  not from some java client
>> 
>> I get module not found, since my service is deployed in tomcat 5.5 with
>> axis
>> 1.0RC1 webapp and globally engage addressing module which I can see from
>> admin page.
> 
> You have engaged addressing in server side. Client is running in a
> different environment.
> 
>> 
>> Do I need to engage addressing module for ServiceClient even I have
>> globally
>> set for all service
>> 
>> When I am debugging my service in eclipse 3.1, I see error module not
>> found
>> ?? after this line of code
>> 
>>             sender.engageModule(new QName(Constants.MODULE_ADDRESSING));
>> 
>>  any idea why it is happening
> 
> Hmm, it seems I better update the FAQ abt this.
> 
> When you run your client, try putting addressing-<version>.mar in your
> classpath.
> 
> -- Chinthaka
> 
> 
> 
--
View this message in context: http://www.nabble.com/-Axis2-1.0RC1-Problem-getting-MessageContext-in-ServiceImpl-class-t1423137.html#a3875656
Sent from the Axis - User forum at Nabble.com.


Re: [Axis2 1.0RC1] Problem getting MessageContext in ServiceImpl class

Posted by Eran Chinthaka <ch...@opensource.lk>.
Gopal Patwa wrote:
> Thanks Chinthaka, It work now but I have some other problem.
> 
> I have wrote axis2 asynchronous service to work with BPEL. When I am trying
> to call BPEL service while to engaging addressing module
> 
>             ServiceClient sender = new ServiceClient();
>             sender.engageModule(new QName(Constants.MODULE_ADDRESSING));
> 
> Note: this code run on tomcat 5.5  not from some java client
> 
> I get module not found, since my service is deployed in tomcat 5.5 with axis
> 1.0RC1 webapp and globally engage addressing module which I can see from
> admin page.

You have engaged addressing in server side. Client is running in a
different environment.

> 
> Do I need to engage addressing module for ServiceClient even I have globally
> set for all service
> 
> When I am debugging my service in eclipse 3.1, I see error module not found
> ?? after this line of code
> 
>             sender.engageModule(new QName(Constants.MODULE_ADDRESSING));
> 
>  any idea why it is happening

Hmm, it seems I better update the FAQ abt this.

When you run your client, try putting addressing-<version>.mar in your
classpath.

-- Chinthaka


Re: [Axis2 1.0RC1] Problem getting MessageContext in ServiceImpl class

Posted by Gopal Patwa <go...@gmail.com>.
Thanks Chinthaka, It work now but I have some other problem.

I have wrote axis2 asynchronous service to work with BPEL. When I am trying
to call BPEL service while to engaging addressing module

            ServiceClient sender = new ServiceClient();
            sender.engageModule(new QName(Constants.MODULE_ADDRESSING));

Note: this code run on tomcat 5.5  not from some java client

I get module not found, since my service is deployed in tomcat 5.5 with axis
1.0RC1 webapp and globally engage addressing module which I can see from
admin page.

Do I need to engage addressing module for ServiceClient even I have globally
set for all service

When I am debugging my service in eclipse 3.1, I see error module not found
?? after this line of code

            sender.engageModule(new QName(Constants.MODULE_ADDRESSING));

 any idea why it is happening

Thanks
Gopal

--
View this message in context: http://www.nabble.com/-Axis2-1.0RC1-Problem-getting-MessageContext-in-ServiceImpl-class-t1423137.html#a3874474
Sent from the Axis - User forum at Nabble.com.


Re: [Axis2 1.0RC1] Problem getting MessageContext in ServiceImpl class

Posted by Eran Chinthaka <ch...@opensource.lk>.
Yes, the change is incorporated in Axis2 1.0 RC1.

Add the method

public void setOperationContext(OperationContext opctx)

in your service class and from that you can get the message contexts.



To get In Message Context :
MessageContext inMsgCtxt  = 	
  	opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)

To get Out Message Context :

MessageContext outMsgCtxt  =
	opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)

-- Chinthaka


Re: [Axis2 1.0RC1] Problem getting MessageContext in ServiceImpl class

Posted by Gopal Patwa <go...@gmail.com>.
Anybody from developer?? Why I am getting NullPointerException for
MessageContext.

I have tried below method also but both MessageContext and OperationContext
are Null

    public void setOpctx(OperationContext opctx) {
        this.opctx = opctx;
    }

 init(MessageContext msgContext) use to work in 0.95 but not anymore  in
1.0RC1 (Tomcat 5.5 app server)

thanks
Gopal
--
View this message in context: http://www.nabble.com/-Axis2-1.0RC1-Problem-getting-MessageContext-in-ServiceImpl-class-t1423137.html#a3853507
Sent from the Axis - User forum at Nabble.com.


Re[Axis2 1.0RC1]: Small changing in Service implementation class

Posted by Gopal Patwa <go...@gmail.com>.
Thanks Deepal,

I already made changes according to Chintaka. Now I have BPEL to Axis2
asynchronous echo service working, earlier when I was invoking BPEL process
as Callback from server, I was usning Axis2 client to make callback like 

            ServiceClient sender = new ServiceClient();
            sender.engageModule(new QName(Constants.MODULE_ADDRESSING)); 

And this use to throw null pointer error, infact I don't need to engage
module b'cos my service and client both running on server side with globally
engage addressing module.

Since I was creating new service client instead from existing current
context like

            ServiceClient  sender = new
ServiceClient(msgContext.getConfigurationContext(),
msgContext.getAxisService());

And this take care of addressing in SOAP Header.

I still have some issue to fix

1) Specifying userdefined wsdl and let axis2 uses my custome wsdl instead of
generating new one( I did meta-inf/services.wsdl in service archive but same
result)

2) Getting error from WSDL2Java when importing ws-addressing schema in wsdl

        <schema xmlns="http://www.w3.org/2001/XMLSchema">
            <import
namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"
schemaLocation="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
        </schema>

You can try yourself , I tried with Xmlbean and Jaxme

I am going to use AsyncMessageReceiver example from integration folder in
SVN to make call back to BPEL 
process instead of using ServiceClient.

I am not sure it will work without making some changes , I will update the
result.

Thanks
Gopal
--
View this message in context: http://www.nabble.com/-Axis2-1.0RC1-Problem-getting-MessageContext-in-ServiceImpl-class-t1423137.html#a3946331
Sent from the Axis - User forum at Nabble.com.


Re: Small changing in Service implementation class

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Gopal;

we have implemented that proposal in Axis2 RC1 :) , so init method which
take message context does not support any more. So you have to add the
setOperationContext(OperationContext opctx) , and get the message
context (opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)).

public void setOperationContext(OperationContext opctx){

this.msgContext = opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
}



Gopal Patwa wrote:

>I  am wondering does below propose from Deepal change is included in axis2
>1.0 RC1. 
>
>I had init method in my service implementation class to get access SOAP
>header from MessageContext to read ws-addressing information but after
>migrating to 1.0RC1 my msgContext is always null, does this method still
>support or there is method signature change.
>
> public void init(MessageContext msgContext) {
>        this.msgContext = msgContext;
>    }
>
>===============================================
>
>Previous mail from Deepal, I am posting this message for reference couldn't
>find the thread .
>
>Hi all;
>
>To support the scenario describe by the JIRA
>http://issues.apache.org/jira/browse/AXIS2-341 , it is require to do
>small changes into service implementation class.
>
>   In the current code base in order to get access to message context he
>has to add init method , and if the init method is present , it will
>call for each and every invocation. (init method can take one message
>context or two message context). I propose to change that to get
>operation context instead of message context and rename method to  
>    setOperationContext(OperationContext opctx);
>
>
>When the session get start up , the init() method of the service class
>will be called (using reflection) if it is present. And method will be
>given the serviceContext corresponds to that service.
>
>    init(ServiceContext serviceCtx)
>
>When the session get invalidate destroy method of the service impl class
>will be called if it present giving ServiceContext as argument.
>
>  destroy(ServiceContext serviceCtx);
>
>  
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~