You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Mayank Thakore <th...@gmail.com> on 2008/01/28 03:10:12 UTC
jms header properties
Hi,
How to set header/property fields in outgoing jms messages?
There is lot of configuration examples to set jms destination
properties. But I didn't find any for message properties.
Thanks and Regards
Mayank
Re: jms header properties
Posted by Daniel Kulp <dk...@apache.org>.
On Thursday 31 January 2008, Mayank Thakore wrote:
> Hi Dan,
>
> This worked very well! How can I do this on the client side?
It's very similar, but kind of in reverse. You also need to deal with
the case of the protocol headers map not being create yet:
BindingProvider bp = (BindingProvider)client;
Map<String, List<String>> headers =
bp.getRequestContext().get(BindingProvider.HTTP_PROTOCOL_HEADERS);
if (headers == null) {
headers = new HashMap<String, List<String>>();
bp.getRequestContext().put(BindingProvider.HTTP_PROTOCOL_HEADERS,
headers);
}
headers.put(......);
etc....
That's it to set them. For the response headers, call the
bp.getResponseContext() method instead.
Dan
On Thursday 31 January 2008, Mayank Thakore wrote:
> Hi Dan,
>
> This worked very well! How can I do this on the client side?
>HTTP_PROTOCOL_HEADERS
> Thanks!
> Mayank
>
> On 1/28/08, Daniel Kulp <dk...@apache.org> wrote:
> > On Monday 28 January 2008, Mayank Thakore wrote:
> > > Hi Daniel,
> > >
> > > Will BindingProvider.HTTP_PROTOCOL_HEADERS work for JMS also?
> >
> > With 2.0.4, yes. Internally, we just have a "PROTOCOL_HEADERS"
> > thing in the message that is completely protocol nuetral. The
> > JAX-WS frontend just maps that onto the HTTP_PROTOCOL_HEADERS thing.
> >
> > > With 1st option:
> > > At the server side, I had to add interceptor. So what I do (in the
> > > service implementation) is to put the jms property in a
> > > threadlocal variable. Then in an interceptor (invoked prior to
> > > send), I use the code mentioned by Willem to put these properties
> > > into the message.
> > >
> > > Do you think this is ok? Any better way?
> >
> > Yes. Inject the WebServiceContext into your service and just set
> > them there. The key would be the class.getName() of the JMS
> > context class.
> >
> > Dan
> >
> > > Thanks!
> > >
> > > Regards
> > > Mayank
> > >
> > > -----Original Message-----
> > > From: Daniel Kulp [mailto:dkulp@apache.org]
> > > Sent: Monday, January 28, 2008 22:03
> > > To: cxf-user@incubator.apache.org
> > > Cc: Mayank Thakore
> > > Subject: Re: jms header properties
> > >
> > >
> > > There are two options:
> > >
> > > 1) the jms context stuff Willem mentioned.
> > >
> > > 2) The standard protocol header things from JAX-WS.
> > >
> > > In the second case, the JMS transport maps the headers onto the
> > > BindingProvider.HTTP_PROTOCOL_HEADERS map thing. Thus, the
> > > normal stuff applies. HOWEVER: that only works with 2.0.4 (to be
> > > released tomorrow) and the 2.1 snapshots. There was a bug that
> > > prevented that from working in earlier versions.
> > >
> > > Dan
> > >
> > > On Sunday 27 January 2008, Mayank Thakore wrote:
> > > > Hi,
> > > >
> > > > How to set header/property fields in outgoing jms messages?
> > > >
> > > > There is lot of configuration examples to set jms destination
> > > > properties. But I didn't find any for message properties.
> > > >
> > > > Thanks and Regards
> > > > Mayank
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog
Re: jms header properties
Posted by Ulhas Bhole <ul...@iona.com>.
If you check the following system test it will show you how to use context.
http://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
Regards,
Ulhas Bhole
Mayank Thakore wrote:
> on server side i used the server response context...
> i noticed that it only copies the jms message properties, not the
> header... for the header server request context seems to work... but
> anyway, i needed only the message properties.
>
> how to get the context on the client side? i want to set jms
> properties on a per message basis.
>
> On 1/31/08, Ulhas Bhole <ul...@iona.com> wrote:
>
>> Which option did you use?
>>
>> you can use JAX-WS requstcontext and responsecontext to get the access
>> to JMS headers at client side.
>>
>> Regards,
>>
>> Ulhas Bhole
>>
>> Mayank Thakore wrote:
>>
>>> Hi Dan,
>>>
>>> This worked very well! How can I do this on the client side?
>>>
>>> Thanks!
>>> Mayank
>>>
>>> On 1/28/08, Daniel Kulp <dk...@apache.org> wrote:
>>>
>>>
>>>> On Monday 28 January 2008, Mayank Thakore wrote:
>>>>
>>>>
>>>>> Hi Daniel,
>>>>>
>>>>> Will BindingProvider.HTTP_PROTOCOL_HEADERS work for JMS also?
>>>>>
>>>>>
>>>> With 2.0.4, yes. Internally, we just have a "PROTOCOL_HEADERS" thing in
>>>> the message that is completely protocol nuetral. The JAX-WS frontend
>>>> just maps that onto the HTTP_PROTOCOL_HEADERS thing.
>>>>
>>>>
>>>>
>>>>> With 1st option:
>>>>> At the server side, I had to add interceptor. So what I do (in the
>>>>> service implementation) is to put the jms property in a threadlocal
>>>>> variable. Then in an interceptor (invoked prior to send), I use the
>>>>> code mentioned by Willem to put these properties into the message.
>>>>>
>>>>> Do you think this is ok? Any better way?
>>>>>
>>>>>
>>>> Yes. Inject the WebServiceContext into your service and just set them
>>>> there. The key would be the class.getName() of the JMS context class.
>>>>
>>>> Dan
>>>>
>>>>
>>>>
>>>>
>>>>> Thanks!
>>>>>
>>>>> Regards
>>>>> Mayank
>>>>>
>>>>> -----Original Message-----
>>>>> From: Daniel Kulp [mailto:dkulp@apache.org]
>>>>> Sent: Monday, January 28, 2008 22:03
>>>>> To: cxf-user@incubator.apache.org
>>>>> Cc: Mayank Thakore
>>>>> Subject: Re: jms header properties
>>>>>
>>>>>
>>>>> There are two options:
>>>>>
>>>>> 1) the jms context stuff Willem mentioned.
>>>>>
>>>>> 2) The standard protocol header things from JAX-WS.
>>>>>
>>>>> In the second case, the JMS transport maps the headers onto the
>>>>> BindingProvider.HTTP_PROTOCOL_HEADERS map thing. Thus, the normal
>>>>> stuff applies. HOWEVER: that only works with 2.0.4 (to be released
>>>>> tomorrow) and the 2.1 snapshots. There was a bug that prevented
>>>>> that from working in earlier versions.
>>>>>
>>>>> Dan
>>>>>
>>>>> On Sunday 27 January 2008, Mayank Thakore wrote:
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> How to set header/property fields in outgoing jms messages?
>>>>>>
>>>>>> There is lot of configuration examples to set jms destination
>>>>>> properties. But I didn't find any for message properties.
>>>>>>
>>>>>> Thanks and Regards
>>>>>> Mayank
>>>>>>
>>>>>>
>>>> --
>>>> J. Daniel Kulp
>>>> Principal Engineer, IONA
>>>> dkulp@apache.org
>>>> http://www.dankulp.com/blog
>>>>
>>>>
>>>>
>> ----------------------------
>> IONA Technologies PLC (registered in Ireland)
>> Registered Number: 171387
>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>>
>>
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: jms header properties
Posted by Mayank Thakore <th...@gmail.com>.
on server side i used the server response context...
i noticed that it only copies the jms message properties, not the
header... for the header server request context seems to work... but
anyway, i needed only the message properties.
how to get the context on the client side? i want to set jms
properties on a per message basis.
On 1/31/08, Ulhas Bhole <ul...@iona.com> wrote:
> Which option did you use?
>
> you can use JAX-WS requstcontext and responsecontext to get the access
> to JMS headers at client side.
>
> Regards,
>
> Ulhas Bhole
>
> Mayank Thakore wrote:
> > Hi Dan,
> >
> > This worked very well! How can I do this on the client side?
> >
> > Thanks!
> > Mayank
> >
> > On 1/28/08, Daniel Kulp <dk...@apache.org> wrote:
> >
> >> On Monday 28 January 2008, Mayank Thakore wrote:
> >>
> >>> Hi Daniel,
> >>>
> >>> Will BindingProvider.HTTP_PROTOCOL_HEADERS work for JMS also?
> >>>
> >> With 2.0.4, yes. Internally, we just have a "PROTOCOL_HEADERS" thing in
> >> the message that is completely protocol nuetral. The JAX-WS frontend
> >> just maps that onto the HTTP_PROTOCOL_HEADERS thing.
> >>
> >>
> >>> With 1st option:
> >>> At the server side, I had to add interceptor. So what I do (in the
> >>> service implementation) is to put the jms property in a threadlocal
> >>> variable. Then in an interceptor (invoked prior to send), I use the
> >>> code mentioned by Willem to put these properties into the message.
> >>>
> >>> Do you think this is ok? Any better way?
> >>>
> >> Yes. Inject the WebServiceContext into your service and just set them
> >> there. The key would be the class.getName() of the JMS context class.
> >>
> >> Dan
> >>
> >>
> >>
> >>> Thanks!
> >>>
> >>> Regards
> >>> Mayank
> >>>
> >>> -----Original Message-----
> >>> From: Daniel Kulp [mailto:dkulp@apache.org]
> >>> Sent: Monday, January 28, 2008 22:03
> >>> To: cxf-user@incubator.apache.org
> >>> Cc: Mayank Thakore
> >>> Subject: Re: jms header properties
> >>>
> >>>
> >>> There are two options:
> >>>
> >>> 1) the jms context stuff Willem mentioned.
> >>>
> >>> 2) The standard protocol header things from JAX-WS.
> >>>
> >>> In the second case, the JMS transport maps the headers onto the
> >>> BindingProvider.HTTP_PROTOCOL_HEADERS map thing. Thus, the normal
> >>> stuff applies. HOWEVER: that only works with 2.0.4 (to be released
> >>> tomorrow) and the 2.1 snapshots. There was a bug that prevented
> >>> that from working in earlier versions.
> >>>
> >>> Dan
> >>>
> >>> On Sunday 27 January 2008, Mayank Thakore wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> How to set header/property fields in outgoing jms messages?
> >>>>
> >>>> There is lot of configuration examples to set jms destination
> >>>> properties. But I didn't find any for message properties.
> >>>>
> >>>> Thanks and Regards
> >>>> Mayank
> >>>>
> >>
> >> --
> >> J. Daniel Kulp
> >> Principal Engineer, IONA
> >> dkulp@apache.org
> >> http://www.dankulp.com/blog
> >>
> >>
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>
Re: jms header properties
Posted by Ulhas Bhole <ul...@iona.com>.
Which option did you use?
you can use JAX-WS requstcontext and responsecontext to get the access
to JMS headers at client side.
Regards,
Ulhas Bhole
Mayank Thakore wrote:
> Hi Dan,
>
> This worked very well! How can I do this on the client side?
>
> Thanks!
> Mayank
>
> On 1/28/08, Daniel Kulp <dk...@apache.org> wrote:
>
>> On Monday 28 January 2008, Mayank Thakore wrote:
>>
>>> Hi Daniel,
>>>
>>> Will BindingProvider.HTTP_PROTOCOL_HEADERS work for JMS also?
>>>
>> With 2.0.4, yes. Internally, we just have a "PROTOCOL_HEADERS" thing in
>> the message that is completely protocol nuetral. The JAX-WS frontend
>> just maps that onto the HTTP_PROTOCOL_HEADERS thing.
>>
>>
>>> With 1st option:
>>> At the server side, I had to add interceptor. So what I do (in the
>>> service implementation) is to put the jms property in a threadlocal
>>> variable. Then in an interceptor (invoked prior to send), I use the
>>> code mentioned by Willem to put these properties into the message.
>>>
>>> Do you think this is ok? Any better way?
>>>
>> Yes. Inject the WebServiceContext into your service and just set them
>> there. The key would be the class.getName() of the JMS context class.
>>
>> Dan
>>
>>
>>
>>> Thanks!
>>>
>>> Regards
>>> Mayank
>>>
>>> -----Original Message-----
>>> From: Daniel Kulp [mailto:dkulp@apache.org]
>>> Sent: Monday, January 28, 2008 22:03
>>> To: cxf-user@incubator.apache.org
>>> Cc: Mayank Thakore
>>> Subject: Re: jms header properties
>>>
>>>
>>> There are two options:
>>>
>>> 1) the jms context stuff Willem mentioned.
>>>
>>> 2) The standard protocol header things from JAX-WS.
>>>
>>> In the second case, the JMS transport maps the headers onto the
>>> BindingProvider.HTTP_PROTOCOL_HEADERS map thing. Thus, the normal
>>> stuff applies. HOWEVER: that only works with 2.0.4 (to be released
>>> tomorrow) and the 2.1 snapshots. There was a bug that prevented
>>> that from working in earlier versions.
>>>
>>> Dan
>>>
>>> On Sunday 27 January 2008, Mayank Thakore wrote:
>>>
>>>> Hi,
>>>>
>>>> How to set header/property fields in outgoing jms messages?
>>>>
>>>> There is lot of configuration examples to set jms destination
>>>> properties. But I didn't find any for message properties.
>>>>
>>>> Thanks and Regards
>>>> Mayank
>>>>
>>
>> --
>> J. Daniel Kulp
>> Principal Engineer, IONA
>> dkulp@apache.org
>> http://www.dankulp.com/blog
>>
>>
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: jms header properties
Posted by Mayank Thakore <th...@gmail.com>.
Hi Dan,
This worked very well! How can I do this on the client side?
Thanks!
Mayank
On 1/28/08, Daniel Kulp <dk...@apache.org> wrote:
> On Monday 28 January 2008, Mayank Thakore wrote:
> > Hi Daniel,
> >
> > Will BindingProvider.HTTP_PROTOCOL_HEADERS work for JMS also?
>
> With 2.0.4, yes. Internally, we just have a "PROTOCOL_HEADERS" thing in
> the message that is completely protocol nuetral. The JAX-WS frontend
> just maps that onto the HTTP_PROTOCOL_HEADERS thing.
>
> > With 1st option:
> > At the server side, I had to add interceptor. So what I do (in the
> > service implementation) is to put the jms property in a threadlocal
> > variable. Then in an interceptor (invoked prior to send), I use the
> > code mentioned by Willem to put these properties into the message.
> >
> > Do you think this is ok? Any better way?
>
> Yes. Inject the WebServiceContext into your service and just set them
> there. The key would be the class.getName() of the JMS context class.
>
> Dan
>
>
> >
> > Thanks!
> >
> > Regards
> > Mayank
> >
> > -----Original Message-----
> > From: Daniel Kulp [mailto:dkulp@apache.org]
> > Sent: Monday, January 28, 2008 22:03
> > To: cxf-user@incubator.apache.org
> > Cc: Mayank Thakore
> > Subject: Re: jms header properties
> >
> >
> > There are two options:
> >
> > 1) the jms context stuff Willem mentioned.
> >
> > 2) The standard protocol header things from JAX-WS.
> >
> > In the second case, the JMS transport maps the headers onto the
> > BindingProvider.HTTP_PROTOCOL_HEADERS map thing. Thus, the normal
> > stuff applies. HOWEVER: that only works with 2.0.4 (to be released
> > tomorrow) and the 2.1 snapshots. There was a bug that prevented
> > that from working in earlier versions.
> >
> > Dan
> >
> > On Sunday 27 January 2008, Mayank Thakore wrote:
> > > Hi,
> > >
> > > How to set header/property fields in outgoing jms messages?
> > >
> > > There is lot of configuration examples to set jms destination
> > > properties. But I didn't find any for message properties.
> > >
> > > Thanks and Regards
> > > Mayank
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
>
Re: jms header properties
Posted by Daniel Kulp <dk...@apache.org>.
On Monday 28 January 2008, Mayank Thakore wrote:
> Hi Daniel,
>
> Will BindingProvider.HTTP_PROTOCOL_HEADERS work for JMS also?
With 2.0.4, yes. Internally, we just have a "PROTOCOL_HEADERS" thing in
the message that is completely protocol nuetral. The JAX-WS frontend
just maps that onto the HTTP_PROTOCOL_HEADERS thing.
> With 1st option:
> At the server side, I had to add interceptor. So what I do (in the
> service implementation) is to put the jms property in a threadlocal
> variable. Then in an interceptor (invoked prior to send), I use the
> code mentioned by Willem to put these properties into the message.
>
> Do you think this is ok? Any better way?
Yes. Inject the WebServiceContext into your service and just set them
there. The key would be the class.getName() of the JMS context class.
Dan
>
> Thanks!
>
> Regards
> Mayank
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Monday, January 28, 2008 22:03
> To: cxf-user@incubator.apache.org
> Cc: Mayank Thakore
> Subject: Re: jms header properties
>
>
> There are two options:
>
> 1) the jms context stuff Willem mentioned.
>
> 2) The standard protocol header things from JAX-WS.
>
> In the second case, the JMS transport maps the headers onto the
> BindingProvider.HTTP_PROTOCOL_HEADERS map thing. Thus, the normal
> stuff applies. HOWEVER: that only works with 2.0.4 (to be released
> tomorrow) and the 2.1 snapshots. There was a bug that prevented
> that from working in earlier versions.
>
> Dan
>
> On Sunday 27 January 2008, Mayank Thakore wrote:
> > Hi,
> >
> > How to set header/property fields in outgoing jms messages?
> >
> > There is lot of configuration examples to set jms destination
> > properties. But I didn't find any for message properties.
> >
> > Thanks and Regards
> > Mayank
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog
RE: jms header properties
Posted by Mayank Thakore <ma...@huawei.com>.
Hi Daniel,
Will BindingProvider.HTTP_PROTOCOL_HEADERS work for JMS also?
With 1st option:
At the server side, I had to add interceptor. So what I do (in the service
implementation) is to put the jms property in a threadlocal variable. Then
in an interceptor (invoked prior to send), I use the code mentioned by
Willem to put these properties into the message.
Do you think this is ok? Any better way?
Thanks!
Regards
Mayank
-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org]
Sent: Monday, January 28, 2008 22:03
To: cxf-user@incubator.apache.org
Cc: Mayank Thakore
Subject: Re: jms header properties
There are two options:
1) the jms context stuff Willem mentioned.
2) The standard protocol header things from JAX-WS.
In the second case, the JMS transport maps the headers onto the
BindingProvider.HTTP_PROTOCOL_HEADERS map thing. Thus, the normal
stuff applies. HOWEVER: that only works with 2.0.4 (to be released
tomorrow) and the 2.1 snapshots. There was a bug that prevented that
from working in earlier versions.
Dan
On Sunday 27 January 2008, Mayank Thakore wrote:
> Hi,
>
> How to set header/property fields in outgoing jms messages?
>
> There is lot of configuration examples to set jms destination
> properties. But I didn't find any for message properties.
>
> Thanks and Regards
> Mayank
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog
Re: jms header properties
Posted by Daniel Kulp <dk...@apache.org>.
There are two options:
1) the jms context stuff Willem mentioned.
2) The standard protocol header things from JAX-WS.
In the second case, the JMS transport maps the headers onto the
BindingProvider.HTTP_PROTOCOL_HEADERS map thing. Thus, the normal
stuff applies. HOWEVER: that only works with 2.0.4 (to be released
tomorrow) and the 2.1 snapshots. There was a bug that prevented that
from working in earlier versions.
Dan
On Sunday 27 January 2008, Mayank Thakore wrote:
> Hi,
>
> How to set header/property fields in outgoing jms messages?
>
> There is lot of configuration examples to set jms destination
> properties. But I didn't find any for message properties.
>
> Thanks and Regards
> Mayank
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog
RE: jms header properties
Posted by Mayank Thakore <ma...@huawei.com>.
Thanks Willem! Got it working!
Regards
Mayank
-----Original Message-----
From: Willem Jiang [mailto:willem.jiang@gmail.com]
Sent: Monday, January 28, 2008 08:53
To: cxf-user@incubator.apache.org
Subject: Re: jms header properties
Hi Mayank,
Here is a systest [1] testContextPropogation() for setting the JMS header.
[1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/ja
va/org/apache/cxf/systest/jms/JMSClientServerTest.java
Willem.
Mayank Thakore wrote:
> Hi,
>
> How to set header/property fields in outgoing jms messages?
>
> There is lot of configuration examples to set jms destination
> properties. But I didn't find any for message properties.
>
> Thanks and Regards
> Mayank
>
>
Re: jms header properties
Posted by Willem Jiang <wi...@gmail.com>.
Hi Mayank,
Here is a systest [1] testContextPropogation() for setting the JMS header.
[1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
Willem.
Mayank Thakore wrote:
> Hi,
>
> How to set header/property fields in outgoing jms messages?
>
> There is lot of configuration examples to set jms destination
> properties. But I didn't find any for message properties.
>
> Thanks and Regards
> Mayank
>
>