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 Denis Goeury <fr...@gmail.com> on 2006/01/27 06:48:52 UTC
Passing properties via MessageContext
Hi,
Is it possible to set MessageContext properties in a handler and
retrieve them from a service class? I have tried with both the module
being referenced in the axis2.xml and later in the service.xml but no
luck.
Thanks in advance,
-denis
Re: Passing properties via MessageContext
Posted by Dies Koper <di...@jp.fujitsu.com>.
Hello Glenn,
Look at section 10.1.3 (ServletEndpointContext) of the JAX-RPC 1.1 spec
for details.
You implement the ServiceLifeCycle interface, which calls your init
method and passes you an instance of the ServletEndpointContext. Use
this to retrieve the Messagecontext in your business methods.
Regards,
Dies
Glenn Bech wrote:
> Version confusion .-) All my fault, as I did not notice the mention of the
> axis2.xml file.
>
>
>
> Thanks for clearing this up :=) If you have any ideas on how to do this
> using axis 1.3.
>
> Please don't hesitate to post :-)
>
>
>
> Glenn
>
>
>
> ________________________________________
>
> From: Thilina Gunarathne [mailto:csethil@gmail.com]
>
> Sent: 29. januar 2006 11:11
>
> To: axis-user@ws.apache.org
>
> Subject: Re: Passing properties via MessageContext
>
>
>
> It's possible.... You can use MessageContext injection for that. This is the
> standard mechanism provided by Axis2 to access MessageContext from service
> impl's....
>
>
>
> public void init(MessageContext msgcts) {
>
> this.msgcts = msgcts;
>
>
>
> }
>
> http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integ
> ration/test/org/apache/axis2/swa/EchoSwA.java?view=markup
>
>
>
> HTH,
>
>
>
> ~Thilina
>
>
>
>
>
> On 1/27/06, glenn bech <gl...@webstep.no> wrote:
>
> The problem is that it is impossible, to my knowledge, to access the message
>
> context from your service class.
>
>
>
> I've seen some pages on the web describing
>
> a way to include the message context in the method signature of the
>
> operation etc, but I remember thinking of it as "hacky" -)
>
>
>
> The only way I've been able to do what you describe, is by using a class
>
> with static members. In the handler you invoke a method that modifies
>
> the static members of a class, the Service class can then use "getters"
>
> on that class to retrieve the data put in by the handler..
>
>
>
> Now... Im sure some people will call this "hacky" as well... .-)
>
>
>
> Hope this helps.
>
>
>
> Glenn
>
>
>
>
>
>
>
> -----Original Message-----
>
> From: Denis Goeury [mailto: freedenix@gmail.com]
>
> Sent: 27. januar 2006 06:49
>
> To: axis-user@ws.apache.org
>
> Subject: Passing properties via MessageContext
>
>
>
> Hi,
>
>
>
> Is it possible to set MessageContext properties in a handler and
>
> retrieve them from a service class? I have tried with both the module
>
> being referenced in the axis2.xml and later in the service.xml but no
>
> luck.
>
>
>
> Thanks in advance,
>
>
>
> -denis
>
>
>
>
>
>
>
>
>
--
Dies KOPER <di...@jp.fujitsu.com> (changed on 1 July 2005)
Fujitsu Ltd - MWPF1 (changed from MWPF3 on 21 Nov 2005)
2-15-16, Shin-Yokohama, Kouhoku-ku, Yokohama, 222-0033, Japan
Tel. +81(45)-475-5605 (internal 7181-4217)
RE: Passing properties via MessageContext
Posted by Glenn Bech <gl...@webstep.no>.
Version confusion .-) All my fault, as I did not notice the mention of the
axis2.xml file.
Thanks for clearing this up :=) If you have any ideas on how to do this
using axis 1.3.
Please don't hesitate to post :-)
Glenn
________________________________________
From: Thilina Gunarathne [mailto:csethil@gmail.com]
Sent: 29. januar 2006 11:11
To: axis-user@ws.apache.org
Subject: Re: Passing properties via MessageContext
It's possible.... You can use MessageContext injection for that. This is the
standard mechanism provided by Axis2 to access MessageContext from service
impl's....
public void init(MessageContext msgcts) {
this.msgcts = msgcts;
}
http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integ
ration/test/org/apache/axis2/swa/EchoSwA.java?view=markup
HTH,
~Thilina
On 1/27/06, glenn bech <gl...@webstep.no> wrote:
The problem is that it is impossible, to my knowledge, to access the message
context from your service class.
I've seen some pages on the web describing
a way to include the message context in the method signature of the
operation etc, but I remember thinking of it as "hacky" -)
The only way I've been able to do what you describe, is by using a class
with static members. In the handler you invoke a method that modifies
the static members of a class, the Service class can then use "getters"
on that class to retrieve the data put in by the handler..
Now... Im sure some people will call this "hacky" as well... .-)
Hope this helps.
Glenn
-----Original Message-----
From: Denis Goeury [mailto: freedenix@gmail.com]
Sent: 27. januar 2006 06:49
To: axis-user@ws.apache.org
Subject: Passing properties via MessageContext
Hi,
Is it possible to set MessageContext properties in a handler and
retrieve them from a service class? I have tried with both the module
being referenced in the axis2.xml and later in the service.xml but no
luck.
Thanks in advance,
-denis
--
"May the SourcE be with u"
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/
http://www.bloglines.com/blog/Thilina
Re: Passing properties via MessageContext
Posted by Thilina Gunarathne <cs...@gmail.com>.
It's possible.... You can use MessageContext injection for that. This is the
standard mechanism provided by Axis2 to access MessageContext from service
impl's....
*public* *void* init(MessageContext msgcts) {
*this*.msgcts = msgcts;
}
http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/swa/EchoSwA.java?view=markup
HTH,
~Thilina
On 1/27/06, glenn bech <gl...@webstep.no> wrote:
>
> The problem is that it is impossible, to my knowledge, to access the
> message
> context from your service class.
>
> I've seen some pages on the web describing
> a way to include the message context in the method signature of the
> operation etc, but I remember thinking of it as "hacky" -)
>
> The only way I've been able to do what you describe, is by using a class
> with static members. In the handler you invoke a method that modifies
> the static members of a class, the Service class can then use "getters"
> on that class to retrieve the data put in by the handler..
>
> Now... Im sure some people will call this "hacky" as well... .-)
>
> Hope this helps.
>
> Glenn
>
>
>
> -----Original Message-----
> From: Denis Goeury [mailto:freedenix@gmail.com]
> Sent: 27. januar 2006 06:49
> To: axis-user@ws.apache.org
> Subject: Passing properties via MessageContext
>
> Hi,
>
> Is it possible to set MessageContext properties in a handler and
> retrieve them from a service class? I have tried with both the module
> being referenced in the axis2.xml and later in the service.xml but no
> luck.
>
> Thanks in advance,
>
> -denis
>
>
>
--
"May the SourcE be with u"
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/
http://www.bloglines.com/blog/Thilina
RE: Passing properties via MessageContext
Posted by glenn bech <gl...@webstep.no>.
The problem is that it is impossible, to my knowledge, to access the message
context from your service class.
I've seen some pages on the web describing
a way to include the message context in the method signature of the
operation etc, but I remember thinking of it as "hacky" -)
The only way I've been able to do what you describe, is by using a class
with static members. In the handler you invoke a method that modifies
the static members of a class, the Service class can then use "getters"
on that class to retrieve the data put in by the handler..
Now... Im sure some people will call this "hacky" as well... .-)
Hope this helps.
Glenn
-----Original Message-----
From: Denis Goeury [mailto:freedenix@gmail.com]
Sent: 27. januar 2006 06:49
To: axis-user@ws.apache.org
Subject: Passing properties via MessageContext
Hi,
Is it possible to set MessageContext properties in a handler and
retrieve them from a service class? I have tried with both the module
being referenced in the axis2.xml and later in the service.xml but no
luck.
Thanks in advance,
-denis