You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Glen Mazza <gl...@gmail.com> on 2010/05/13 02:32:20 UTC

Retrieving a MessageContext property from an Async handler

Hello, I asked this question early this morning on the Metro list and didn't
get an answer, perhaps the CXF list can help me here:

http://old.nabble.com/Retrieving-MessageContext-properties-from-asynchronous-SOAP-calls-tp28535341p28535341.html

Basically, I'm making async soap calls and due to a customer desire I also
need to track the size in bytes of the SOAP response.  I was thinking of
using a JAX-WS handler to read the SOAP XML and get a count in bytes and
store it in a MessageContext property, but I don't know how I can get that
information to the async handler so I can persist that information.

One possibility might be to have the SOAP client store a Map (soap call id#,
size in bytes) as a MessageContext property and have the JAX-WS handler
update that Map.  The async handler could be initialized with the same Map
object and soap call id# and then just read in bytes from that Map--would
that work and be safe across multiple async calls?  Any ideas?

Thanks,
Glen
-- 
View this message in context: http://old.nabble.com/Retrieving-a-MessageContext-property-from-an-Async-handler-tp28542540p28542540.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Retrieving a MessageContext property from an Async handler

Posted by Glen Mazza <gl...@gmail.com>.
Great--thanks!

Glen



dkulp wrote:
> 
> 
> Glen,
> 
> The "Response" object that is passed into your async handler has a
> getContex() 
> method on it that returns the context for that response.   Thus, in your 
> handler, if you set a property on the context with application scope, that 
> property should be retrievable from the context provided by the Response 
> object.
> 
> Dan
> 
> 
>  
> On Wednesday 12 May 2010 8:32:20 pm Glen Mazza wrote
>> Hello, I asked this question early this morning on the Metro list and
>> didn't get an answer, perhaps the CXF list can help me here:
>> 
>> http://old.nabble.com/Retrieving-MessageContext-properties-from-asynchronou
>> s-SOAP-calls-tp28535341p28535341.html
>> 
>> Basically, I'm making async soap calls and due to a customer desire I
>> also
>> need to track the size in bytes of the SOAP response.  I was thinking of
>> using a JAX-WS handler to read the SOAP XML and get a count in bytes and
>> store it in a MessageContext property, but I don't know how I can get
>> that
>> information to the async handler so I can persist that information.
>> 
>> One possibility might be to have the SOAP client store a Map (soap call
>> id#, size in bytes) as a MessageContext property and have the JAX-WS
>> handler update that Map.  The async handler could be initialized with the
>> same Map object and soap call id# and then just read in bytes from that
>> Map--would that work and be safe across multiple async calls?  Any ideas?
>> 
>> Thanks,
>> Glen
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/Retrieving-a-MessageContext-property-from-an-Async-handler-tp28542540p28543150.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Retrieving a MessageContext property from an Async handler

Posted by Daniel Kulp <dk...@apache.org>.
Glen,

The "Response" object that is passed into your async handler has a getContex() 
method on it that returns the context for that response.   Thus, in your 
handler, if you set a property on the context with application scope, that 
property should be retrievable from the context provided by the Response 
object.

Dan


 
On Wednesday 12 May 2010 8:32:20 pm Glen Mazza wrote
> Hello, I asked this question early this morning on the Metro list and
> didn't get an answer, perhaps the CXF list can help me here:
> 
> http://old.nabble.com/Retrieving-MessageContext-properties-from-asynchronou
> s-SOAP-calls-tp28535341p28535341.html
> 
> Basically, I'm making async soap calls and due to a customer desire I also
> need to track the size in bytes of the SOAP response.  I was thinking of
> using a JAX-WS handler to read the SOAP XML and get a count in bytes and
> store it in a MessageContext property, but I don't know how I can get that
> information to the async handler so I can persist that information.
> 
> One possibility might be to have the SOAP client store a Map (soap call
> id#, size in bytes) as a MessageContext property and have the JAX-WS
> handler update that Map.  The async handler could be initialized with the
> same Map object and soap call id# and then just read in bytes from that
> Map--would that work and be safe across multiple async calls?  Any ideas?
> 
> Thanks,
> Glen

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog