You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Frederic Tuttle <fj...@gmail.com> on 2009/07/14 15:20:30 UTC

Accessing custom message headers from CXF SE

Greetings,

Besides using SOAP headers, is there a way to get access to the normalized
message properties/headers from CXF SE ?  I've inserted some custom headers
into the message (from a CXF BC interceptor and a Camel Processor)  and I'd
like to read them at the CXF SE.

Thanks for your help.

  -FT

Re: Accessing custom message headers from CXF SE

Posted by Freeman Fang <fr...@gmail.com>.
On 2009-7-19, at 上午11:17, Frederic Tuttle wrote:

> Thanks Freeman.
>
> I think the approach you described with WebServiceContext is the best
> approach.  Would this feature be available soon ?
Yeah, actually get properties from JBI message in pojo(as the code I  
show) already there
>
> Regarding the key for the map, I should have said "variable" holding  
> the
> key.  If I store the context in the map using whatever key, I need  
> to hold
> the value of the key somewhere so I may use it to retrieve from the  
> map.
> There's no place to store the value of the key that won't get  
> overwritten.
> And the exchange ID isn't available at the pojo unless I inject it  
> with the
> interceptor.
>
> Is it possible to set singleton="false" on the pojo bean definition in
> xbean.xml ?
>
simply set singleton="false" for the pojo isn't enough, if you want to  
create service object per request, one possible way is you need  
implement your own org.apache.cxf.service.invoker.Invoker, but I don't  
think it's a simple task,  and the default JAXWSMethodInvoker used in  
cxf can't do that.

Freeman
> Thanks again.
>  -FT
>
> On Sat, Jul 18, 2009 at 10:34 PM, Freeman Fang  
> <fr...@gmail.com>wrote:
>
>>
>> On 2009-7-19, at 上午10:11, Frederic Tuttle wrote:
>>
>> Freeman,
>>>
>>> Perhaps I'm a bit ignorant on this, but shouldn't each invocation  
>>> of the
>>> pojo bean for an exchange be in it's own thread with it's own  
>>> instance of
>>> the pojo ?  I understood what you said about the serviceContext  
>>> getting
>>> overwritten, but I had imagined that the instance of the pojo was  
>>> tied up
>>> for the duration of the exchange.
>>>
>>> If the pojo is actually a singleton then your suggestion about the  
>>> map
>>> makes
>>> sense.  But I've got a chicken & egg situation because I need to  
>>> store the
>>> key for the map in the pojo. Wouldn't it get overwritten too ?
>>>
>> Yes, the pojo is singleton
>> If you worry about the key for the map would be  overwritten, then  
>> it's not
>> this case, the key I suggest  is MesageExchange Id which is unique  
>> across
>> JBI container, so it's impossible to be overwritten.
>> Instead of let customer use interceptors and maintain the map  
>> themselves,
>> we also discuss the possibility to use WebServiceContext injection,  
>> as
>> injected WebServiceContext for pojo instanse is threadlocal, so it's
>> naturally threadsafe, you can easily use it like in your pojo
>>
>> @Resource
>>   private WebServiceContext wsContext;
>>
>> Then can use code like
>>           MessageContext ctx = wsContext.getMessageContext();
>>           Message message =
>> ((WrappedMessageContext)ctx).getWrappedMessage();
>>           MessageExchange messageExchange =
>> message.get(MessageExchange.class);
>>           NormalizedMessage normalizedMessage =
>> messageExchange.getMessage("in");
>> to get the NormalizedMessage and then get properties from it.
>>
>> Freeman
>>
>>
>>
>>
>>> Please pardon my lack of understanding.  I'd be grateful for any  
>>> further
>>> help.
>>>
>>> This situation makes it more apparent that we need a good way to  
>>> propagate
>>> context to the CXF-SE pojo.
>>>
>>> -FT
>>>
>>>
>>> On Wed, Jul 15, 2009 at 11:17 PM, Freeman Fang <freeman.fang@gmail.com
>>>> wrote:
>>>
>>> Hi,
>>>>
>>>> IMO, thread safe or not totally depend on your own  
>>>> implementation. In
>>>> your
>>>> case, I don't think it's a good idea that simply put code like
>>>> providerBean.setCustomContext(customContext);
>>>> in your interceptor, that's absolutely not theadsafe as the  
>>>> customContext
>>>> will be overridden easily by next imcoming messge.
>>>> However, if you maintain a Map in your pojo like
>>>> private Map<String, Object> messages = new  
>>>> ConcurrentHashMap<String,
>>>> Object>();
>>>> And use the id of your MessageExchange(exchange.getExchangeId())  
>>>> as the
>>>> key
>>>> of this map, then I believe it's threadsafe.
>>>>
>>>> Freeman
>>>>
>>>>
>>>>
>>>> On 2009-7-16, at 上午12:56, Frederic Tuttle wrote:
>>>>
>>>> Fellas, I got it working-- at least I think.  I had some spring  
>>>> bean
>>>>
>>>>> reference incorrect.
>>>>>
>>>>> <cxfse:endpoint>
>>>>> <cxfse:pojo>
>>>>>    <ref bean="providerBean"/>
>>>>> </cxfse:pojo>
>>>>>
>>>>> <cxfse:inInterceptors>
>>>>>    <ref bean="ctxInterceptor"/>
>>>>> </cxfse:inInterceptors>
>>>>>
>>>>> </cxfse:endpoint>
>>>>>
>>>>>
>>>>> <bean class="ProviderBean" id="providerBean"/>
>>>>>
>>>>> <bean class="ContextExtractorInterceptor" id="ctxInterceptor">
>>>>>
>>>>> <property name="providerBean">
>>>>>    <ref bean="providerBean"/>
>>>>> </property>
>>>>>
>>>>> </bean>
>>>>>
>>>>> And in ContextExtractorInterceptor:
>>>>>
>>>>> public void setProviderBean(ProviderBean bean) {
>>>>> this.providerBean = bean;
>>>>> }
>>>>>
>>>>> public void handleMessage(Message message) {
>>>>>
>>>>> MessageExchange exchange = message.get(MessageExchange.class);
>>>>> NormalizedMessage nMessage =  (NormalizedMessage)
>>>>> exchange.getMessage("in");
>>>>>
>>>>> Object customContext = nMessage.getProperty("customContext");
>>>>>
>>>>> providerBean.setCustomContext(customContext);
>>>>> }
>>>>>
>>>>> But as Jakob noted, I'm concerned about thread safety. I need to  
>>>>> try
>>>>> some
>>>>> things out.
>>>>>
>>>>> -FT
>>>>>
>>>>> On Wed, Jul 15, 2009 at 11:53 AM, Jakob Günther <jakobguenther@yahoo.d 
>>>>> e
>>>>>
>>>>>> wrote:
>>>>>>
>>>>>
>>>>> hi,
>>>>>
>>>>>> I have the same question. I succeeded injecting the interceptor  
>>>>>> into
>>>>>> the
>>>>>> pojo. But I don't think this is thread-save.
>>>>>> Jakob
>>>>>>
>>>>>> my xbean.xml:
>>>>>> <beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
>>>>>> xmlns:person="http://servicemix.apache.org/samples/wsdl-first">
>>>>>>
>>>>>> <cxfse:endpoint mtomEnabled="true">
>>>>>> <cxfse:pojo>
>>>>>>    <bean  
>>>>>> class="org.apache.servicemix.samples.wsdl_first.PersonImpl">
>>>>>>
>>>>>>      <ref bean="propIntercepter"/>
>>>>>>
>>>>>>   </bean>
>>>>>>   </cxfse:pojo>
>>>>>>   <cxfse:inInterceptors>
>>>>>>      <ref bean="propInterceptor"/>
>>>>>>   </cxfse:inInterceptors>
>>>>>> </cxfse:endpoint>
>>>>>>
>>>>>> <bean id="propInterceptor"
>>>>>> class="org.apache.servicemix.samples.PropertyIntercepter"/>
>>>>>>
>>>>>> </beans>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Frederic Tuttle schrieb:
>>>>>>
>>>>>> Freeman,
>>>>>>
>>>>>>>
>>>>>>> That worked-- mostly.
>>>>>>> How do you suggest I get the intercepted information from the
>>>>>>> interceptor
>>>>>>> into my CXF SE pojo ?   I tried injecting the pojo into the
>>>>>>> interceptor
>>>>>>> in
>>>>>>> xbean.xml but I was unsuccessful.
>>>>>>> Thanks.
>>>>>>> -FT
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jul 14, 2009 at 9:39 AM, Freeman Fang <freeman.fang@gmail.com
>>>>>>>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>>
>>>>>>>> We've discussed this issue on this list before, take a look at
>>>>>>>> [1]&[2]
>>>>>>>> [1]
>>>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230
>>>>>>>> |<
>>>>>>>>
>>>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C
>>>>>>>>
>>>>>>>>>
>>>>>>>>> <
>>>>>>>>
>>>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C
>>>>>>>>
>>>>>>>>>
>>>>>>>>> a22581230
>>>>>>>> [2]
>>>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688
>>>>>>>>
>>>>>>>> Freeman
>>>>>>>>
>>>>>>>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>>>>>>>
>>>>>>>> Greetings,
>>>>>>>>
>>>>>>>> Besides using SOAP headers, is there a way to get access to the
>>>>>>>>
>>>>>>>>> normalized
>>>>>>>>> message properties/headers from CXF SE ?  I've inserted some  
>>>>>>>>> custom
>>>>>>>>> headers
>>>>>>>>> into the message (from a CXF BC interceptor and a Camel  
>>>>>>>>> Processor)
>>>>>>>>> and
>>>>>>>>> I'd
>>>>>>>>> like to read them at the CXF SE.
>>>>>>>>>
>>>>>>>>> Thanks for your help.
>>>>>>>>>
>>>>>>>>> -FT
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>> Freeman Fang
>>>>>>>> ------------------------
>>>>>>>> Open Source SOA: http://fusesource.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>> --
>>>> Freeman Fang
>>>> ------------------------
>>>> Open Source SOA: http://fusesource.com
>>>>
>>>>
>>>>
>>
>> --
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: Accessing custom message headers from CXF SE

Posted by Frederic Tuttle <fj...@gmail.com>.
Thanks Freeman.

I think the approach you described with WebServiceContext is the best
approach.  Would this feature be available soon ?

Regarding the key for the map, I should have said "variable" holding the
key.  If I store the context in the map using whatever key, I need to hold
the value of the key somewhere so I may use it to retrieve from the map.
There's no place to store the value of the key that won't get overwritten.
And the exchange ID isn't available at the pojo unless I inject it with the
interceptor.

Is it possible to set singleton="false" on the pojo bean definition in
xbean.xml ?

Thanks again.
  -FT

On Sat, Jul 18, 2009 at 10:34 PM, Freeman Fang <fr...@gmail.com>wrote:

>
> On 2009-7-19, at 上午10:11, Frederic Tuttle wrote:
>
>  Freeman,
>>
>> Perhaps I'm a bit ignorant on this, but shouldn't each invocation of the
>> pojo bean for an exchange be in it's own thread with it's own instance of
>> the pojo ?  I understood what you said about the serviceContext getting
>> overwritten, but I had imagined that the instance of the pojo was tied up
>> for the duration of the exchange.
>>
>> If the pojo is actually a singleton then your suggestion about the map
>> makes
>> sense.  But I've got a chicken & egg situation because I need to store the
>> key for the map in the pojo. Wouldn't it get overwritten too ?
>>
> Yes, the pojo is singleton
> If you worry about the key for the map would be  overwritten, then it's not
> this case, the key I suggest  is MesageExchange Id which is unique across
> JBI container, so it's impossible to be overwritten.
> Instead of let customer use interceptors and maintain the map themselves,
> we also discuss the possibility to use WebServiceContext injection, as
> injected WebServiceContext for pojo instanse is threadlocal, so it's
> naturally threadsafe, you can easily use it like in your pojo
>
> @Resource
>    private WebServiceContext wsContext;
>
> Then can use code like
>            MessageContext ctx = wsContext.getMessageContext();
>            Message message =
> ((WrappedMessageContext)ctx).getWrappedMessage();
>            MessageExchange messageExchange =
> message.get(MessageExchange.class);
>            NormalizedMessage normalizedMessage =
> messageExchange.getMessage("in");
> to get the NormalizedMessage and then get properties from it.
>
> Freeman
>
>
>
>
>> Please pardon my lack of understanding.  I'd be grateful for any further
>> help.
>>
>> This situation makes it more apparent that we need a good way to propagate
>> context to the CXF-SE pojo.
>>
>>  -FT
>>
>>
>> On Wed, Jul 15, 2009 at 11:17 PM, Freeman Fang <freeman.fang@gmail.com
>> >wrote:
>>
>>  Hi,
>>>
>>> IMO, thread safe or not totally depend on your own implementation. In
>>> your
>>> case, I don't think it's a good idea that simply put code like
>>> providerBean.setCustomContext(customContext);
>>> in your interceptor, that's absolutely not theadsafe as the customContext
>>> will be overridden easily by next imcoming messge.
>>> However, if you maintain a Map in your pojo like
>>> private Map<String, Object> messages = new ConcurrentHashMap<String,
>>> Object>();
>>> And use the id of your MessageExchange(exchange.getExchangeId()) as the
>>> key
>>> of this map, then I believe it's threadsafe.
>>>
>>> Freeman
>>>
>>>
>>>
>>> On 2009-7-16, at 上午12:56, Frederic Tuttle wrote:
>>>
>>> Fellas, I got it working-- at least I think.  I had some spring bean
>>>
>>>> reference incorrect.
>>>>
>>>> <cxfse:endpoint>
>>>>  <cxfse:pojo>
>>>>     <ref bean="providerBean"/>
>>>>  </cxfse:pojo>
>>>>
>>>>  <cxfse:inInterceptors>
>>>>     <ref bean="ctxInterceptor"/>
>>>>  </cxfse:inInterceptors>
>>>>
>>>> </cxfse:endpoint>
>>>>
>>>>
>>>> <bean class="ProviderBean" id="providerBean"/>
>>>>
>>>> <bean class="ContextExtractorInterceptor" id="ctxInterceptor">
>>>>
>>>>  <property name="providerBean">
>>>>     <ref bean="providerBean"/>
>>>>  </property>
>>>>
>>>> </bean>
>>>>
>>>> And in ContextExtractorInterceptor:
>>>>
>>>> public void setProviderBean(ProviderBean bean) {
>>>>  this.providerBean = bean;
>>>> }
>>>>
>>>> public void handleMessage(Message message) {
>>>>
>>>>  MessageExchange exchange = message.get(MessageExchange.class);
>>>>  NormalizedMessage nMessage =  (NormalizedMessage)
>>>> exchange.getMessage("in");
>>>>
>>>>  Object customContext = nMessage.getProperty("customContext");
>>>>
>>>>  providerBean.setCustomContext(customContext);
>>>> }
>>>>
>>>> But as Jakob noted, I'm concerned about thread safety. I need to try
>>>> some
>>>> things out.
>>>>
>>>> -FT
>>>>
>>>> On Wed, Jul 15, 2009 at 11:53 AM, Jakob Günther <jakobguenther@yahoo.de
>>>>
>>>>> wrote:
>>>>>
>>>>
>>>> hi,
>>>>
>>>>> I have the same question. I succeeded injecting the interceptor into
>>>>> the
>>>>> pojo. But I don't think this is thread-save.
>>>>> Jakob
>>>>>
>>>>> my xbean.xml:
>>>>> <beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
>>>>> xmlns:person="http://servicemix.apache.org/samples/wsdl-first">
>>>>>
>>>>> <cxfse:endpoint mtomEnabled="true">
>>>>>  <cxfse:pojo>
>>>>>     <bean class="org.apache.servicemix.samples.wsdl_first.PersonImpl">
>>>>>
>>>>>       <ref bean="propIntercepter"/>
>>>>>
>>>>>    </bean>
>>>>>    </cxfse:pojo>
>>>>>    <cxfse:inInterceptors>
>>>>>       <ref bean="propInterceptor"/>
>>>>>    </cxfse:inInterceptors>
>>>>> </cxfse:endpoint>
>>>>>
>>>>> <bean id="propInterceptor"
>>>>> class="org.apache.servicemix.samples.PropertyIntercepter"/>
>>>>>
>>>>> </beans>
>>>>>
>>>>>
>>>>>
>>>>> Frederic Tuttle schrieb:
>>>>>
>>>>> Freeman,
>>>>>
>>>>>>
>>>>>> That worked-- mostly.
>>>>>> How do you suggest I get the intercepted information from the
>>>>>> interceptor
>>>>>> into my CXF SE pojo ?   I tried injecting the pojo into the
>>>>>> interceptor
>>>>>> in
>>>>>> xbean.xml but I was unsuccessful.
>>>>>> Thanks.
>>>>>> -FT
>>>>>>
>>>>>>
>>>>>> On Tue, Jul 14, 2009 at 9:39 AM, Freeman Fang <freeman.fang@gmail.com
>>>>>>
>>>>>>  wrote:
>>>>>>>
>>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>
>>>>>>> We've discussed this issue on this list before, take a look at
>>>>>>> [1]&[2]
>>>>>>> [1]
>>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230
>>>>>>> |<
>>>>>>>
>>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C
>>>>>>>
>>>>>>>>
>>>>>>>>  <
>>>>>>>
>>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C
>>>>>>>
>>>>>>>>
>>>>>>>>  a22581230
>>>>>>> [2]
>>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688
>>>>>>>
>>>>>>> Freeman
>>>>>>>
>>>>>>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>>>>>>
>>>>>>> Greetings,
>>>>>>>
>>>>>>> Besides using SOAP headers, is there a way to get access to the
>>>>>>>
>>>>>>>> normalized
>>>>>>>> message properties/headers from CXF SE ?  I've inserted some custom
>>>>>>>> headers
>>>>>>>> into the message (from a CXF BC interceptor and a Camel Processor)
>>>>>>>> and
>>>>>>>> I'd
>>>>>>>> like to read them at the CXF SE.
>>>>>>>>
>>>>>>>> Thanks for your help.
>>>>>>>>
>>>>>>>> -FT
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>> Freeman Fang
>>>>>>> ------------------------
>>>>>>> Open Source SOA: http://fusesource.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>> --
>>> Freeman Fang
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>>
>>>
>>>
>
> --
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
>
>

Re: Accessing custom message headers from CXF SE

Posted by Freeman Fang <fr...@gmail.com>.
On 2009-7-19, at 上午10:11, Frederic Tuttle wrote:

> Freeman,
>
> Perhaps I'm a bit ignorant on this, but shouldn't each invocation of  
> the
> pojo bean for an exchange be in it's own thread with it's own  
> instance of
> the pojo ?  I understood what you said about the serviceContext  
> getting
> overwritten, but I had imagined that the instance of the pojo was  
> tied up
> for the duration of the exchange.
>
> If the pojo is actually a singleton then your suggestion about the  
> map makes
> sense.  But I've got a chicken & egg situation because I need to  
> store the
> key for the map in the pojo. Wouldn't it get overwritten too ?
Yes, the pojo is singleton
If you worry about the key for the map would be  overwritten, then  
it's not this case, the key I suggest  is MesageExchange Id which is  
unique across JBI container, so it's impossible to be overwritten.
Instead of let customer use interceptors and maintain the map  
themselves, we also discuss the possibility to use WebServiceContext  
injection, as injected WebServiceContext for pojo instanse is  
threadlocal, so it's naturally threadsafe, you can easily use it like  
in your pojo

@Resource
     private WebServiceContext wsContext;

Then can use code like
             MessageContext ctx = wsContext.getMessageContext();
             Message message =  
((WrappedMessageContext)ctx).getWrappedMessage();
             MessageExchange messageExchange =  
message.get(MessageExchange.class);
             NormalizedMessage normalizedMessage =  
messageExchange.getMessage("in");
to get the NormalizedMessage and then get properties from it.

Freeman


>
> Please pardon my lack of understanding.  I'd be grateful for any  
> further
> help.
>
> This situation makes it more apparent that we need a good way to  
> propagate
> context to the CXF-SE pojo.
>
>  -FT
>
>
> On Wed, Jul 15, 2009 at 11:17 PM, Freeman Fang  
> <fr...@gmail.com>wrote:
>
>> Hi,
>>
>> IMO, thread safe or not totally depend on your own implementation.  
>> In your
>> case, I don't think it's a good idea that simply put code like
>> providerBean.setCustomContext(customContext);
>> in your interceptor, that's absolutely not theadsafe as the  
>> customContext
>> will be overridden easily by next imcoming messge.
>> However, if you maintain a Map in your pojo like
>> private Map<String, Object> messages = new ConcurrentHashMap<String,
>> Object>();
>> And use the id of your MessageExchange(exchange.getExchangeId()) as  
>> the key
>> of this map, then I believe it's threadsafe.
>>
>> Freeman
>>
>>
>>
>> On 2009-7-16, at 上午12:56, Frederic Tuttle wrote:
>>
>> Fellas, I got it working-- at least I think.  I had some spring bean
>>> reference incorrect.
>>>
>>> <cxfse:endpoint>
>>>   <cxfse:pojo>
>>>      <ref bean="providerBean"/>
>>>  </cxfse:pojo>
>>>
>>>  <cxfse:inInterceptors>
>>>      <ref bean="ctxInterceptor"/>
>>>  </cxfse:inInterceptors>
>>>
>>> </cxfse:endpoint>
>>>
>>>
>>> <bean class="ProviderBean" id="providerBean"/>
>>>
>>> <bean class="ContextExtractorInterceptor" id="ctxInterceptor">
>>>
>>>  <property name="providerBean">
>>>      <ref bean="providerBean"/>
>>>  </property>
>>>
>>> </bean>
>>>
>>> And in ContextExtractorInterceptor:
>>>
>>> public void setProviderBean(ProviderBean bean) {
>>>  this.providerBean = bean;
>>> }
>>>
>>> public void handleMessage(Message message) {
>>>
>>>  MessageExchange exchange = message.get(MessageExchange.class);
>>>  NormalizedMessage nMessage =  (NormalizedMessage)
>>> exchange.getMessage("in");
>>>
>>>  Object customContext = nMessage.getProperty("customContext");
>>>
>>>  providerBean.setCustomContext(customContext);
>>> }
>>>
>>> But as Jakob noted, I'm concerned about thread safety. I need to  
>>> try some
>>> things out.
>>>
>>> -FT
>>>
>>> On Wed, Jul 15, 2009 at 11:53 AM, Jakob Günther <jakobguenther@yahoo.d 
>>> e
>>>> wrote:
>>>
>>> hi,
>>>> I have the same question. I succeeded injecting the interceptor  
>>>> into the
>>>> pojo. But I don't think this is thread-save.
>>>> Jakob
>>>>
>>>> my xbean.xml:
>>>> <beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
>>>> xmlns:person="http://servicemix.apache.org/samples/wsdl-first">
>>>>
>>>> <cxfse:endpoint mtomEnabled="true">
>>>>   <cxfse:pojo>
>>>>      <bean  
>>>> class="org.apache.servicemix.samples.wsdl_first.PersonImpl">
>>>>
>>>>        <ref bean="propIntercepter"/>
>>>>
>>>>     </bean>
>>>>     </cxfse:pojo>
>>>>     <cxfse:inInterceptors>
>>>>        <ref bean="propInterceptor"/>
>>>>     </cxfse:inInterceptors>
>>>> </cxfse:endpoint>
>>>>
>>>> <bean id="propInterceptor"
>>>> class="org.apache.servicemix.samples.PropertyIntercepter"/>
>>>>
>>>> </beans>
>>>>
>>>>
>>>>
>>>> Frederic Tuttle schrieb:
>>>>
>>>> Freeman,
>>>>>
>>>>> That worked-- mostly.
>>>>> How do you suggest I get the intercepted information from the
>>>>> interceptor
>>>>> into my CXF SE pojo ?   I tried injecting the pojo into the  
>>>>> interceptor
>>>>> in
>>>>> xbean.xml but I was unsuccessful.
>>>>> Thanks.
>>>>> -FT
>>>>>
>>>>>
>>>>> On Tue, Jul 14, 2009 at 9:39 AM, Freeman Fang <freeman.fang@gmail.com
>>>>>
>>>>>> wrote:
>>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>>>
>>>>>> We've discussed this issue on this list before, take a look at  
>>>>>> [1]&[2]
>>>>>> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230
>>>>>> |<
>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C
>>>>>>>
>>>>>> <
>>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C
>>>>>>>
>>>>>> a22581230
>>>>>> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688
>>>>>>
>>>>>> Freeman
>>>>>>
>>>>>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>>>>>
>>>>>> Greetings,
>>>>>>
>>>>>> Besides using SOAP headers, is there a way to get access to the
>>>>>>> normalized
>>>>>>> message properties/headers from CXF SE ?  I've inserted some  
>>>>>>> custom
>>>>>>> headers
>>>>>>> into the message (from a CXF BC interceptor and a Camel  
>>>>>>> Processor)
>>>>>>> and
>>>>>>> I'd
>>>>>>> like to read them at the CXF SE.
>>>>>>>
>>>>>>> Thanks for your help.
>>>>>>>
>>>>>>> -FT
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>> Freeman Fang
>>>>>> ------------------------
>>>>>> Open Source SOA: http://fusesource.com
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>
>> --
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: Accessing custom message headers from CXF SE

Posted by Frederic Tuttle <fj...@gmail.com>.
Freeman,

Perhaps I'm a bit ignorant on this, but shouldn't each invocation of the
pojo bean for an exchange be in it's own thread with it's own instance of
the pojo ?  I understood what you said about the serviceContext getting
overwritten, but I had imagined that the instance of the pojo was tied up
for the duration of the exchange.

If the pojo is actually a singleton then your suggestion about the map makes
sense.  But I've got a chicken & egg situation because I need to store the
key for the map in the pojo. Wouldn't it get overwritten too ?

Please pardon my lack of understanding.  I'd be grateful for any further
help.

This situation makes it more apparent that we need a good way to propagate
context to the CXF-SE pojo.

  -FT


On Wed, Jul 15, 2009 at 11:17 PM, Freeman Fang <fr...@gmail.com>wrote:

> Hi,
>
> IMO, thread safe or not totally depend on your own implementation. In your
> case, I don't think it's a good idea that simply put code like
> providerBean.setCustomContext(customContext);
> in your interceptor, that's absolutely not theadsafe as the customContext
> will be overridden easily by next imcoming messge.
> However, if you maintain a Map in your pojo like
> private Map<String, Object> messages = new ConcurrentHashMap<String,
> Object>();
> And use the id of your MessageExchange(exchange.getExchangeId()) as the key
> of this map, then I believe it's threadsafe.
>
> Freeman
>
>
>
> On 2009-7-16, at 上午12:56, Frederic Tuttle wrote:
>
>  Fellas, I got it working-- at least I think.  I had some spring bean
>> reference incorrect.
>>
>> <cxfse:endpoint>
>>    <cxfse:pojo>
>>       <ref bean="providerBean"/>
>>   </cxfse:pojo>
>>
>>   <cxfse:inInterceptors>
>>       <ref bean="ctxInterceptor"/>
>>   </cxfse:inInterceptors>
>>
>>  </cxfse:endpoint>
>>
>>
>> <bean class="ProviderBean" id="providerBean"/>
>>
>> <bean class="ContextExtractorInterceptor" id="ctxInterceptor">
>>
>>   <property name="providerBean">
>>       <ref bean="providerBean"/>
>>   </property>
>>
>> </bean>
>>
>> And in ContextExtractorInterceptor:
>>
>> public void setProviderBean(ProviderBean bean) {
>>   this.providerBean = bean;
>> }
>>
>> public void handleMessage(Message message) {
>>
>>   MessageExchange exchange = message.get(MessageExchange.class);
>>   NormalizedMessage nMessage =  (NormalizedMessage)
>> exchange.getMessage("in");
>>
>>   Object customContext = nMessage.getProperty("customContext");
>>
>>   providerBean.setCustomContext(customContext);
>> }
>>
>> But as Jakob noted, I'm concerned about thread safety. I need to try some
>> things out.
>>
>>  -FT
>>
>> On Wed, Jul 15, 2009 at 11:53 AM, Jakob Günther <jakobguenther@yahoo.de
>> >wrote:
>>
>>  hi,
>>> I have the same question. I succeeded injecting the interceptor into the
>>> pojo. But I don't think this is thread-save.
>>> Jakob
>>>
>>> my xbean.xml:
>>> <beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
>>>  xmlns:person="http://servicemix.apache.org/samples/wsdl-first">
>>>
>>>  <cxfse:endpoint mtomEnabled="true">
>>>    <cxfse:pojo>
>>>       <bean class="org.apache.servicemix.samples.wsdl_first.PersonImpl">
>>>
>>>         <ref bean="propIntercepter"/>
>>>
>>>      </bean>
>>>      </cxfse:pojo>
>>>      <cxfse:inInterceptors>
>>>         <ref bean="propInterceptor"/>
>>>      </cxfse:inInterceptors>
>>>  </cxfse:endpoint>
>>>
>>>  <bean id="propInterceptor"
>>> class="org.apache.servicemix.samples.PropertyIntercepter"/>
>>>
>>> </beans>
>>>
>>>
>>>
>>> Frederic Tuttle schrieb:
>>>
>>>  Freeman,
>>>>
>>>> That worked-- mostly.
>>>> How do you suggest I get the intercepted information from the
>>>> interceptor
>>>> into my CXF SE pojo ?   I tried injecting the pojo into the interceptor
>>>> in
>>>> xbean.xml but I was unsuccessful.
>>>> Thanks.
>>>>  -FT
>>>>
>>>>
>>>> On Tue, Jul 14, 2009 at 9:39 AM, Freeman Fang <freeman.fang@gmail.com
>>>>
>>>>> wrote:
>>>>>
>>>>
>>>> Hi,
>>>>
>>>>>
>>>>> We've discussed this issue on this list before, take a look at [1]&[2]
>>>>> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230
>>>>> |<
>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C
>>>>> >
>>>>> <
>>>>> http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C
>>>>> >
>>>>> a22581230
>>>>> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688
>>>>>
>>>>> Freeman
>>>>>
>>>>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>>>>
>>>>> Greetings,
>>>>>
>>>>>  Besides using SOAP headers, is there a way to get access to the
>>>>>> normalized
>>>>>> message properties/headers from CXF SE ?  I've inserted some custom
>>>>>> headers
>>>>>> into the message (from a CXF BC interceptor and a Camel Processor)
>>>>>>  and
>>>>>> I'd
>>>>>> like to read them at the CXF SE.
>>>>>>
>>>>>> Thanks for your help.
>>>>>>
>>>>>> -FT
>>>>>>
>>>>>>
>>>>>>  --
>>>>> Freeman Fang
>>>>> ------------------------
>>>>> Open Source SOA: http://fusesource.com
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>
> --
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
>
>

Re: Accessing custom message headers from CXF SE

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

IMO, thread safe or not totally depend on your own implementation. In  
your case, I don't think it's a good idea that simply put code like
providerBean.setCustomContext(customContext);
in your interceptor, that's absolutely not theadsafe as the  
customContext will be overridden easily by next imcoming messge.
However, if you maintain a Map in your pojo like
private Map<String, Object> messages = new ConcurrentHashMap<String,  
Object>();
And use the id of your MessageExchange(exchange.getExchangeId()) as  
the key of this map, then I believe it's threadsafe.

Freeman


On 2009-7-16, at 上午12:56, Frederic Tuttle wrote:

> Fellas, I got it working-- at least I think.  I had some spring bean
> reference incorrect.
>
> <cxfse:endpoint>
>     <cxfse:pojo>
>        <ref bean="providerBean"/>
>    </cxfse:pojo>
>
>    <cxfse:inInterceptors>
>        <ref bean="ctxInterceptor"/>
>    </cxfse:inInterceptors>
>
>  </cxfse:endpoint>
>
>
> <bean class="ProviderBean" id="providerBean"/>
>
> <bean class="ContextExtractorInterceptor" id="ctxInterceptor">
>
>    <property name="providerBean">
>        <ref bean="providerBean"/>
>    </property>
>
> </bean>
>
> And in ContextExtractorInterceptor:
>
> public void setProviderBean(ProviderBean bean) {
>    this.providerBean = bean;
> }
>
> public void handleMessage(Message message) {
>
>    MessageExchange exchange = message.get(MessageExchange.class);
>    NormalizedMessage nMessage =  (NormalizedMessage)
> exchange.getMessage("in");
>
>    Object customContext = nMessage.getProperty("customContext");
>
>    providerBean.setCustomContext(customContext);
> }
>
> But as Jakob noted, I'm concerned about thread safety. I need to try  
> some
> things out.
>
>   -FT
>
> On Wed, Jul 15, 2009 at 11:53 AM, Jakob Günther <jakobguenther@yahoo.d 
> e>wrote:
>
>> hi,
>> I have the same question. I succeeded injecting the interceptor  
>> into the
>> pojo. But I don't think this is thread-save.
>> Jakob
>>
>> my xbean.xml:
>> <beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
>>   xmlns:person="http://servicemix.apache.org/samples/wsdl-first">
>>
>>  <cxfse:endpoint mtomEnabled="true">
>>     <cxfse:pojo>
>>        <bean  
>> class="org.apache.servicemix.samples.wsdl_first.PersonImpl">
>>
>>          <ref bean="propIntercepter"/>
>>
>>       </bean>
>>       </cxfse:pojo>
>>       <cxfse:inInterceptors>
>>          <ref bean="propInterceptor"/>
>>       </cxfse:inInterceptors>
>>   </cxfse:endpoint>
>>
>>   <bean id="propInterceptor"
>> class="org.apache.servicemix.samples.PropertyIntercepter"/>
>>
>> </beans>
>>
>>
>>
>> Frederic Tuttle schrieb:
>>
>>> Freeman,
>>>
>>> That worked-- mostly.
>>> How do you suggest I get the intercepted information from the  
>>> interceptor
>>> into my CXF SE pojo ?   I tried injecting the pojo into the  
>>> interceptor in
>>> xbean.xml but I was unsuccessful.
>>> Thanks.
>>>  -FT
>>>
>>>
>>> On Tue, Jul 14, 2009 at 9:39 AM, Freeman Fang  
>>> <freeman.fang@gmail.com
>>>> wrote:
>>>
>>> Hi,
>>>>
>>>> We've discussed this issue on this list before, take a look at  
>>>> [1]&[2]
>>>> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230 
>>>> |<http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C 
>>>> >
>>>> <http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C 
>>>> >
>>>> a22581230
>>>> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688
>>>>
>>>> Freeman
>>>>
>>>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>>>
>>>> Greetings,
>>>>
>>>>> Besides using SOAP headers, is there a way to get access to the
>>>>> normalized
>>>>> message properties/headers from CXF SE ?  I've inserted some  
>>>>> custom
>>>>> headers
>>>>> into the message (from a CXF BC interceptor and a Camel  
>>>>> Processor)  and
>>>>> I'd
>>>>> like to read them at the CXF SE.
>>>>>
>>>>> Thanks for your help.
>>>>>
>>>>> -FT
>>>>>
>>>>>
>>>> --
>>>> Freeman Fang
>>>> ------------------------
>>>> Open Source SOA: http://fusesource.com
>>>>
>>>>
>>>>
>>>
>>
>>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: Accessing custom message headers from CXF SE

Posted by Frederic Tuttle <fj...@gmail.com>.
Fellas, I got it working-- at least I think.  I had some spring bean
reference incorrect.

 <cxfse:endpoint>
     <cxfse:pojo>
        <ref bean="providerBean"/>
    </cxfse:pojo>

    <cxfse:inInterceptors>
        <ref bean="ctxInterceptor"/>
    </cxfse:inInterceptors>

  </cxfse:endpoint>


 <bean class="ProviderBean" id="providerBean"/>

 <bean class="ContextExtractorInterceptor" id="ctxInterceptor">

    <property name="providerBean">
        <ref bean="providerBean"/>
    </property>

 </bean>

And in ContextExtractorInterceptor:

 public void setProviderBean(ProviderBean bean) {
    this.providerBean = bean;
 }

 public void handleMessage(Message message) {

    MessageExchange exchange = message.get(MessageExchange.class);
    NormalizedMessage nMessage =  (NormalizedMessage)
exchange.getMessage("in");

    Object customContext = nMessage.getProperty("customContext");

    providerBean.setCustomContext(customContext);
 }

But as Jakob noted, I'm concerned about thread safety. I need to try some
things out.

   -FT

On Wed, Jul 15, 2009 at 11:53 AM, Jakob Günther <ja...@yahoo.de>wrote:

> hi,
> I have the same question. I succeeded injecting the interceptor into the
> pojo. But I don't think this is thread-save.
> Jakob
>
> my xbean.xml:
> <beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
>    xmlns:person="http://servicemix.apache.org/samples/wsdl-first">
>
>   <cxfse:endpoint mtomEnabled="true">
>      <cxfse:pojo>
>         <bean class="org.apache.servicemix.samples.wsdl_first.PersonImpl">
>
>           <ref bean="propIntercepter"/>
>
>        </bean>
>        </cxfse:pojo>
>        <cxfse:inInterceptors>
>           <ref bean="propInterceptor"/>
>        </cxfse:inInterceptors>
>    </cxfse:endpoint>
>
>    <bean id="propInterceptor"
> class="org.apache.servicemix.samples.PropertyIntercepter"/>
>
> </beans>
>
>
>
> Frederic Tuttle schrieb:
>
>> Freeman,
>>
>> That worked-- mostly.
>> How do you suggest I get the intercepted information from the interceptor
>> into my CXF SE pojo ?   I tried injecting the pojo into the interceptor in
>> xbean.xml but I was unsuccessful.
>> Thanks.
>>   -FT
>>
>>
>> On Tue, Jul 14, 2009 at 9:39 AM, Freeman Fang <freeman.fang@gmail.com
>> >wrote:
>>
>>  Hi,
>>>
>>> We've discussed this issue on this list before, take a look at [1]&[2]
>>> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230|<http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C>
>>> <http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C>
>>> a22581230
>>> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688
>>>
>>> Freeman
>>>
>>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>>
>>>  Greetings,
>>>
>>>> Besides using SOAP headers, is there a way to get access to the
>>>> normalized
>>>> message properties/headers from CXF SE ?  I've inserted some custom
>>>> headers
>>>> into the message (from a CXF BC interceptor and a Camel Processor)  and
>>>> I'd
>>>> like to read them at the CXF SE.
>>>>
>>>> Thanks for your help.
>>>>
>>>>  -FT
>>>>
>>>>
>>> --
>>> Freeman Fang
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>>
>>>
>>>
>>
>
>

Re: Accessing custom message headers from CXF SE

Posted by Jakob Günther <ja...@yahoo.de>.
hi,
I have the same question. I succeeded injecting the interceptor into the 
pojo. But I don't think this is thread-save.
Jakob

my xbean.xml:
<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
     xmlns:person="http://servicemix.apache.org/samples/wsdl-first">

    <cxfse:endpoint mtomEnabled="true">
       <cxfse:pojo>
          <bean class="org.apache.servicemix.samples.wsdl_first.PersonImpl">

            <ref bean="propIntercepter"/>

        	</bean>
         </cxfse:pojo>
         <cxfse:inInterceptors>
            <ref bean="propInterceptor"/>
         </cxfse:inInterceptors>
     </cxfse:endpoint>

     <bean id="propInterceptor" 
class="org.apache.servicemix.samples.PropertyIntercepter"/>
	
</beans>



Frederic Tuttle schrieb:
> Freeman,
> 
> That worked-- mostly.
> How do you suggest I get the intercepted information from the interceptor
> into my CXF SE pojo ?   I tried injecting the pojo into the interceptor in
> xbean.xml but I was unsuccessful.
> Thanks.
>    -FT
> 
> 
> On Tue, Jul 14, 2009 at 9:39 AM, Freeman Fang <fr...@gmail.com>wrote:
> 
>> Hi,
>>
>> We've discussed this issue on this list before, take a look at [1]&[2]
>> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230|<http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C>
>> a22581230
>> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688
>>
>> Freeman
>>
>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>
>>  Greetings,
>>> Besides using SOAP headers, is there a way to get access to the normalized
>>> message properties/headers from CXF SE ?  I've inserted some custom
>>> headers
>>> into the message (from a CXF BC interceptor and a Camel Processor)  and
>>> I'd
>>> like to read them at the CXF SE.
>>>
>>> Thanks for your help.
>>>
>>>  -FT
>>>
>>
>> --
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>
> 



Re: Accessing custom message headers from CXF SE

Posted by Frederic Tuttle <fj...@gmail.com>.
Freeman,

That worked-- mostly.
How do you suggest I get the intercepted information from the interceptor
into my CXF SE pojo ?   I tried injecting the pojo into the interceptor in
xbean.xml but I was unsuccessful.
Thanks.
   -FT


On Tue, Jul 14, 2009 at 9:39 AM, Freeman Fang <fr...@gmail.com>wrote:

> Hi,
>
> We've discussed this issue on this list before, take a look at [1]&[2]
> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230|<http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230%7C>
> a22581230
> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688
>
> Freeman
>
> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>
>  Greetings,
>>
>> Besides using SOAP headers, is there a way to get access to the normalized
>> message properties/headers from CXF SE ?  I've inserted some custom
>> headers
>> into the message (from a CXF BC interceptor and a Camel Processor)  and
>> I'd
>> like to read them at the CXF SE.
>>
>> Thanks for your help.
>>
>>  -FT
>>
>
>
> --
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
>
>

Re: Accessing custom message headers from CXF SE

Posted by Freeman Fang <fr...@gmail.com>.
Create [1] to track this issue

[1]https://issues.apache.org/activemq/browse/SMXCOMP-593

Freeman
On 2009-7-17, at 上午1:48, rgavlin wrote:

>
> Hi Freeman,
>
> This looks very webservice friendly and CXF-ish which is quite nice.  
> During
> your investigation, please verify that  
> messageExchange.getMessage("out") can
> be used to set out properties as well.
>
> I will open a JIRA for this feature.
>
> Thanks,
>
> /Ron
>
>
> Freeman Fang wrote:
>>
>> Hi Ron,
>>
>> After investigate the cxf code, I think there is another way to
>> support get/set In/Out Jbi Properties in smx-cxf-se endpoint which is
>> more natural for webservice.
>> The way is to use WebserviceContext injection, for example, if user
>> want to extract jbi message properties in cxf se pojo, then he can
>> just put code like
>>
>>     @Resource
>>     private WebServiceContext wsContext;
>>
>> Then can use code like
>>             MessageContext ctx = wsContext.getMessageContext();
>>             Message message =
>> ((WrappedMessageContext)ctx).getWrappedMessage();
>>             MessageExchange messageExchange =
>> message.get(MessageExchange.class);
>>             NormalizedMessage normalizedMessage =
>> messageExchange.getMessage("in");
>> to get the NormalizedMessage and then get properties from it.
>>
>> I believe this is more suitable than adding interceptors, what do you
>> think?
>> If you also think this is a good way, would you please rasie a jira
>> ticket to track it? The feature is almost here, but I need go through
>> cxf jbi transport to make sure the set properties also work and  
>> ensure
>> this implementation is threadsafe (though I believe so...)
>>
>>
>> Freeman
>>
>> On 2009-7-16, at 下午5:49, rgavlin wrote:
>>
>>>
>>> Freeman,
>>>
>>> Is there a way you could support In/Out Jbi Properties Interceptors
>>> in a
>>> standardized fashion? Most Jbi components provide a way to manage
>>> all three
>>> parts of a NormalizedMessage. The smx-cxf-se already handles content
>>> and
>>> attachments. It would seem to make sense for the smx-cxf-se to
>>> provide a
>>> standardized way to handle properties as well.
>>>
>>> /Ron
>>>
>>>
>>> Freeman Fang wrote:
>>>>
>>>> Hi,
>>>>
>>>> We've discussed this issue on this list before, take a look at
>>>> [1]&[2]
>>>> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230
>>>> |
>>>> a22581230
>>>> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble-
>>>> td22993688
>>>>
>>>> Freeman
>>>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>>>
>>>>> Greetings,
>>>>>
>>>>> Besides using SOAP headers, is there a way to get access to the
>>>>> normalized
>>>>> message properties/headers from CXF SE ?  I've inserted some  
>>>>> custom
>>>>> headers
>>>>> into the message (from a CXF BC interceptor and a Camel Processor)
>>>>> and I'd
>>>>> like to read them at the CXF SE.
>>>>>
>>>>> Thanks for your help.
>>>>>
>>>>> -FT
>>>>
>>>>
>>>> -- 
>>>> Freeman Fang
>>>> ------------------------
>>>> Open Source SOA: http://fusesource.com
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Accessing-custom-message-headers-from-CXF-SE-tp24479395p24513428.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>
>>
>> -- 
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Accessing-custom-message-headers-from-CXF-SE-tp24479395p24521283.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: Accessing custom message headers from CXF SE

Posted by rgavlin <rg...@yahoo.com>.
Hi Freeman,

This looks very webservice friendly and CXF-ish which is quite nice. During
your investigation, please verify that messageExchange.getMessage("out") can
be used to set out properties as well.

I will open a JIRA for this feature.

Thanks,

/Ron


Freeman Fang wrote:
> 
> Hi Ron,
> 
> After investigate the cxf code, I think there is another way to  
> support get/set In/Out Jbi Properties in smx-cxf-se endpoint which is  
> more natural for webservice.
> The way is to use WebserviceContext injection, for example, if user  
> want to extract jbi message properties in cxf se pojo, then he can  
> just put code like
> 
>      @Resource
>      private WebServiceContext wsContext;
> 
> Then can use code like
>              MessageContext ctx = wsContext.getMessageContext();
>              Message message =  
> ((WrappedMessageContext)ctx).getWrappedMessage();
>              MessageExchange messageExchange =  
> message.get(MessageExchange.class);
>              NormalizedMessage normalizedMessage =  
> messageExchange.getMessage("in");
> to get the NormalizedMessage and then get properties from it.
> 
> I believe this is more suitable than adding interceptors, what do you  
> think?
> If you also think this is a good way, would you please rasie a jira  
> ticket to track it? The feature is almost here, but I need go through  
> cxf jbi transport to make sure the set properties also work and ensure  
> this implementation is threadsafe (though I believe so...)
> 
> 
> Freeman
> 
> On 2009-7-16, at 下午5:49, rgavlin wrote:
> 
>>
>> Freeman,
>>
>> Is there a way you could support In/Out Jbi Properties Interceptors  
>> in a
>> standardized fashion? Most Jbi components provide a way to manage  
>> all three
>> parts of a NormalizedMessage. The smx-cxf-se already handles content  
>> and
>> attachments. It would seem to make sense for the smx-cxf-se to  
>> provide a
>> standardized way to handle properties as well.
>>
>> /Ron
>>
>>
>> Freeman Fang wrote:
>>>
>>> Hi,
>>>
>>> We've discussed this issue on this list before, take a look at  
>>> [1]&[2]
>>> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230 
>>> |
>>> a22581230
>>> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble- 
>>> td22993688
>>>
>>> Freeman
>>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>>
>>>> Greetings,
>>>>
>>>> Besides using SOAP headers, is there a way to get access to the
>>>> normalized
>>>> message properties/headers from CXF SE ?  I've inserted some custom
>>>> headers
>>>> into the message (from a CXF BC interceptor and a Camel Processor)
>>>> and I'd
>>>> like to read them at the CXF SE.
>>>>
>>>> Thanks for your help.
>>>>
>>>> -FT
>>>
>>>
>>> -- 
>>> Freeman Fang
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Accessing-custom-message-headers-from-CXF-SE-tp24479395p24513428.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
> 
> 
> -- 
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Accessing-custom-message-headers-from-CXF-SE-tp24479395p24521283.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Accessing custom message headers from CXF SE

Posted by Freeman Fang <fr...@gmail.com>.
Hi Ron,

After investigate the cxf code, I think there is another way to  
support get/set In/Out Jbi Properties in smx-cxf-se endpoint which is  
more natural for webservice.
The way is to use WebserviceContext injection, for example, if user  
want to extract jbi message properties in cxf se pojo, then he can  
just put code like

     @Resource
     private WebServiceContext wsContext;

Then can use code like
             MessageContext ctx = wsContext.getMessageContext();
             Message message =  
((WrappedMessageContext)ctx).getWrappedMessage();
             MessageExchange messageExchange =  
message.get(MessageExchange.class);
             NormalizedMessage normalizedMessage =  
messageExchange.getMessage("in");
to get the NormalizedMessage and then get properties from it.

I believe this is more suitable than adding interceptors, what do you  
think?
If you also think this is a good way, would you please rasie a jira  
ticket to track it? The feature is almost here, but I need go through  
cxf jbi transport to make sure the set properties also work and ensure  
this implementation is threadsafe (though I believe so...)


Freeman

On 2009-7-16, at 下午5:49, rgavlin wrote:

>
> Freeman,
>
> Is there a way you could support In/Out Jbi Properties Interceptors  
> in a
> standardized fashion? Most Jbi components provide a way to manage  
> all three
> parts of a NormalizedMessage. The smx-cxf-se already handles content  
> and
> attachments. It would seem to make sense for the smx-cxf-se to  
> provide a
> standardized way to handle properties as well.
>
> /Ron
>
>
> Freeman Fang wrote:
>>
>> Hi,
>>
>> We've discussed this issue on this list before, take a look at  
>> [1]&[2]
>> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230 
>> |
>> a22581230
>> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble- 
>> td22993688
>>
>> Freeman
>> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
>>
>>> Greetings,
>>>
>>> Besides using SOAP headers, is there a way to get access to the
>>> normalized
>>> message properties/headers from CXF SE ?  I've inserted some custom
>>> headers
>>> into the message (from a CXF BC interceptor and a Camel Processor)
>>> and I'd
>>> like to read them at the CXF SE.
>>>
>>> Thanks for your help.
>>>
>>> -FT
>>
>>
>> -- 
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Accessing-custom-message-headers-from-CXF-SE-tp24479395p24513428.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: Accessing custom message headers from CXF SE

Posted by rgavlin <rg...@yahoo.com>.
Freeman,

Is there a way you could support In/Out Jbi Properties Interceptors in a
standardized fashion? Most Jbi components provide a way to manage all three
parts of a NormalizedMessage. The smx-cxf-se already handles content and
attachments. It would seem to make sense for the smx-cxf-se to provide a
standardized way to handle properties as well.

/Ron


Freeman Fang wrote:
> 
> Hi,
> 
> We've discussed this issue on this list before, take a look at [1]&[2]
> [1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230| 
> a22581230
> [2]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688
> 
> Freeman
> On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:
> 
>> Greetings,
>>
>> Besides using SOAP headers, is there a way to get access to the  
>> normalized
>> message properties/headers from CXF SE ?  I've inserted some custom  
>> headers
>> into the message (from a CXF BC interceptor and a Camel Processor)   
>> and I'd
>> like to read them at the CXF SE.
>>
>> Thanks for your help.
>>
>>  -FT
> 
> 
> -- 
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Accessing-custom-message-headers-from-CXF-SE-tp24479395p24513428.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Accessing custom message headers from CXF SE

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

We've discussed this issue on this list before, take a look at [1]&[2]
[1]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22581230| 
a22581230
[2]http://cwiki.apache.org/SM/discussion-forums.html#nabble-td22993688

Freeman
On 2009-7-14, at 下午9:20, Frederic Tuttle wrote:

> Greetings,
>
> Besides using SOAP headers, is there a way to get access to the  
> normalized
> message properties/headers from CXF SE ?  I've inserted some custom  
> headers
> into the message (from a CXF BC interceptor and a Camel Processor)   
> and I'd
> like to read them at the CXF SE.
>
> Thanks for your help.
>
>  -FT


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com