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 Michele Mazzucco <Mi...@ncl.ac.uk> on 2006/05/03 11:12:27 UTC

[Axis2] How to get MessageContext

Hi all,

how can I get the MessageContext from a OMelement?
(I'm using the primary interface APIs, that is my methods have the
following signature:

OMelement operation(OMElement arg1, OMElelent arg2,..., OMElement argN) {
	...
}

)



Thanks,
Michele

Re: [Axis2] How to get MessageContext

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Hi Eran,

please read the thread about "asynchronous messaging" between me and
Deepal. Maybe I miss the point.


Thanks in advance,
Michele

Eran Chinthaka wrote:
> OMElement is just a representation of an XML fragment. There is no
> connection in that to the message context.
> 
> BTW, from where you wanna do this ?
> 
> Michele Mazzucco wrote:
>> Hi all,
>>
>> how can I get the MessageContext from a OMelement?
>> (I'm using the primary interface APIs, that is my methods have the
>> following signature:
>>
>> OMelement operation(OMElement arg1, OMElelent arg2,..., OMElement argN) {
>> 	...
>> }
>>
>> )
>>
>>
>>
>> Thanks,
>> Michele
>>
> 
> 

Re: [Axis2] How to get MessageContext

Posted by Eran Chinthaka <ch...@opensource.lk>.
OMElement is just a representation of an XML fragment. There is no
connection in that to the message context.

BTW, from where you wanna do this ?

Michele Mazzucco wrote:
> Hi all,
> 
> how can I get the MessageContext from a OMelement?
> (I'm using the primary interface APIs, that is my methods have the
> following signature:
> 
> OMelement operation(OMElement arg1, OMElelent arg2,..., OMElement argN) {
> 	...
> }
> 
> )
> 
> 
> 
> Thanks,
> Michele
> 



Re: [Axis2] How to get MessageContext

Posted by Ruchith Fernando <ru...@gmail.com>.
An example for such a service impl class is here : [1]

Thanks,
Ruchith

[1] https://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/oasis/ping/PingPortSkeleton.java

On 5/3/06, Deepal Jayasinghe <de...@opensource.lk> wrote:
> ya , just add that method in to service impl class and that method will
> be called using java reflection. So you  can keep a ref to
> operatoionConetx in side your class instance. And when you get the
> actual method call you can access that.
>
> Michele Mazzucco wrote:
>
> >Hi Deepal,
> >
> >could you be more explicit please? Do you mean
> >
> >public void setOperationContext(OperationContext opctx) {
> >       // empty content
> >}
> >
> >(and I don't need to call it)?
> >
> >
> >Michele
> >
> >Deepal Jayasinghe wrote:
> >
> >
> >>you have to add a method called
> >>setOperationContext(OperationContext opctx) {
> >>}
> >>
> >>in to your sevrice impl class , and that method will be called whenever
> >>you get a req . Using opctx you can get the messagecontext
> >>
> >>
> >>Michele Mazzucco wrote:
> >>
> >>
> >>
> >>>Hi all,
> >>>
> >>>how can I get the MessageContext from a OMelement?
> >>>(I'm using the primary interface APIs, that is my methods have the
> >>>following signature:
> >>>
> >>>OMelement operation(OMElement arg1, OMElelent arg2,..., OMElement argN) {
> >>>     ...
> >>>}
> >>>
> >>>)
> >>>
> >>>
> >>>
> >>>Thanks,
> >>>Michele
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
>
> --
> Thanks,
> Deepal
> ................................................................
> ~Future is Open~
>
>
>

Re: [Axis2] How to get MessageContext

Posted by Deepal Jayasinghe <de...@opensource.lk>.
ya , just add that method in to service impl class and that method will
be called using java reflection. So you  can keep a ref to
operatoionConetx in side your class instance. And when you get the
actual method call you can access that.

Michele Mazzucco wrote:

>Hi Deepal,
>
>could you be more explicit please? Do you mean
>
>public void setOperationContext(OperationContext opctx) {
>	// empty content
>}
>
>(and I don't need to call it)?
>
>
>Michele
>
>Deepal Jayasinghe wrote:
>  
>
>>you have to add a method called
>>setOperationContext(OperationContext opctx) {
>>}
>>
>>in to your sevrice impl class , and that method will be called whenever
>>you get a req . Using opctx you can get the messagecontext
>>
>>
>>Michele Mazzucco wrote:
>>
>>    
>>
>>>Hi all,
>>>
>>>how can I get the MessageContext from a OMelement?
>>>(I'm using the primary interface APIs, that is my methods have the
>>>following signature:
>>>
>>>OMelement operation(OMElement arg1, OMElelent arg2,..., OMElement argN) {
>>>	...
>>>}
>>>
>>>)
>>>
>>>
>>>
>>>Thanks,
>>>Michele
>>>
>>>
>>> 
>>>
>>>      
>>>
>
>
>  
>

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



Re: [Axis2] How to get MessageContext

Posted by Ajith Ranabahu <aj...@gmail.com>.
Hi,
this is called dependency injection. The Axis2 runtime will call the
method and pump in the correct opContext. You'll have to grab the
needed message context when that happens so you better have some code
that assigns the needed message context to a private variable
inside that method!
Note that this method is called before your business methods so it is
safe to assume that opcontext will be presented to you before anything
else

On 5/3/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
> Hi Deepal,
>
> could you be more explicit please? Do you mean
>
> public void setOperationContext(OperationContext opctx) {
>         // empty content
> }
>
> (and I don't need to call it)?
>
>
> Michele
>
> Deepal Jayasinghe wrote:
> > you have to add a method called
> > setOperationContext(OperationContext opctx) {
> > }
> >
> > in to your sevrice impl class , and that method will be called whenever
> > you get a req . Using opctx you can get the messagecontext
> >
> >
> > Michele Mazzucco wrote:
> >
> >> Hi all,
> >>
> >> how can I get the MessageContext from a OMelement?
> >> (I'm using the primary interface APIs, that is my methods have the
> >> following signature:
> >>
> >> OMelement operation(OMElement arg1, OMElelent arg2,..., OMElement argN) {
> >>      ...
> >> }
> >>
> >> )
> >>
> >>
> >>
> >> Thanks,
> >> Michele
> >>
> >>
> >>
> >>
> >
>


--
Ajith Ranabahu

Re: [Axis2] How to get MessageContext

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Hi Deepal,

could you be more explicit please? Do you mean

public void setOperationContext(OperationContext opctx) {
	// empty content
}

(and I don't need to call it)?


Michele

Deepal Jayasinghe wrote:
> you have to add a method called
> setOperationContext(OperationContext opctx) {
> }
> 
> in to your sevrice impl class , and that method will be called whenever
> you get a req . Using opctx you can get the messagecontext
> 
> 
> Michele Mazzucco wrote:
> 
>> Hi all,
>>
>> how can I get the MessageContext from a OMelement?
>> (I'm using the primary interface APIs, that is my methods have the
>> following signature:
>>
>> OMelement operation(OMElement arg1, OMElelent arg2,..., OMElement argN) {
>> 	...
>> }
>>
>> )
>>
>>
>>
>> Thanks,
>> Michele
>>
>>
>>  
>>
> 

Re: [Axis2] How to get MessageContext

Posted by Deepal Jayasinghe <de...@opensource.lk>.
you have to add a method called
setOperationContext(OperationContext opctx) {
}

in to your sevrice impl class , and that method will be called whenever
you get a req . Using opctx you can get the messagecontext


Michele Mazzucco wrote:

>Hi all,
>
>how can I get the MessageContext from a OMelement?
>(I'm using the primary interface APIs, that is my methods have the
>following signature:
>
>OMelement operation(OMElement arg1, OMElelent arg2,..., OMElement argN) {
>	...
>}
>
>)
>
>
>
>Thanks,
>Michele
>
>
>  
>

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