camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: CxfExchange is not anymore available in Camel 2.0.0
Date Thu, 13 May 2010 12:44:51 GMT
Hi William

Current camel supports to turn the CxfPayLoad object into a String, as 
Camel converter will call the CxfPayLoad.toString() method to do this 
kind job.

But if you just want to get the payload body, I'm afraid you still need 
to use the below code to do the job.

Willem

William Tam wrote:
> I need to correct my previous reply.  Are you using PAYLOAD or POJO 
> mode?  (I assume you are using PAYLOAD.)   The body is a CxfPayload 
> object which contains  a list DOM elements.   The snippet would like 
> this instead.
> 
> Message message = exchange.getIn();
> String request = message.getBody(String.class);
> 
> // We don't need the follow once we have a converter for CxfPayload-> 
> String
> if (request == null) {
>   CxfPayload payload = message.getBody(CxfPayload.class);
>   if (payload != null) {
>     request = getRequestFromSource(payload.getBody());
>   }
> }
> 
> The getRequestFromSource(List<Element>) method takes a list of Element 
> and convert them to a String.  I created a Jira for adding a converter 
> that converts a CxfPayload to a String so it is not needed in the 
> future.    (https://issues.apache.org/activemq/browse/CAMEL-2714)
> 
> 
> 
> On 05/12/2010 11:54 AM, William Tam wrote:
>> You can do something like this:
>>
>> Message message = exchange.getIn();
>> String request = message.getBody(String.class);
>> if (request == null) {
>>   Source source = message.getBody(Source.class);
>>   if (source != null) {
>>     request = getRequestFromSource(source);
>>   }
>> }
>>
>> If we had a converter to covert from CXF payload to string, we 
>> wouldn't the logic in "if (request == null)".
>>
>>
>>
>> On 05/12/2010 11:24 AM, fjaouen wrote:
>>> With 1.5.0 I was checking the instance of Exchange in a process 
>>> method to
>>> know if I have a CxfMessage or a JMSMessage in order to do different
>>> treatment.
>>>
>>>          if (aExchange instanceof JmsExchange) {
>>>              JmsMessage jmsMessage = (JmsMessage) aExchange.getIn();
>>>              String request = jmsMessage.getBody(String.class);
>>> ...
>>>          }
>>>          else if (aExchange instanceof CxfExchange) {
>>>              CxfMessage cxfMessage = (CxfMessage) aExchange.getIn();
>>>              Source source = cxfMessage.getBody(Source.class);
>>>              String request = getRequestFromSource(source);
>>> ...
>>>          }
>>>
>>> So now how can I do this check ? On which object may I determine that I
>>> receive a CXF or a JMS ?
>>>
>>> Thank you !
>>>
>>>
>>>
>>> hzbarcea wrote:
>>>> All DefaultExchange specializations were removed in 2.0.0.  What
>>>> seemed a good idea initially proved to be unnecessary.  This has been
>>>> communicated in the 2.0.0 Release Note [1]: "Exchange api cleanup.
>>>> Complete removal of specialized Exchange using generics."
>>>>
>>>> The specialized Messages were preserved as they may deal with
>>>> specialized types of body (payloads).  You need use the
>>>> DefaultExchange instead of CxfExchange.  If you have any issues don't
>>>> hesitate to ask.
>>>>
>>>> Cheers,
>>>> Hadrian
>>>>
>>>> [1] http://camel.apache.org/camel-200-release.html
>>>>
>>>>
>>>> On Nov 13, 2009, at 1:31 PM, fjaouen wrote:
>>>>
>>>>> Hi there,
>>>>>
>>>>> I am currently using Camel 1.5.0 and I am trying to make a migration
>>>>> to
>>>>> 2.0.0 version.
>>>>>
>>>>> It seems that org.apache.camel.component.cxf.CxfExchange class is not
>>>>> anymore available in this new version ?
>>>>>
>>>>> What is its remplacement ?
>>>>>
>>>>> Is there an easy way to know what has been removed in this new
>>>>> version or a
>>>>> documentation explaining how to migrate these changes ?
>>>>>
>>>>> Thank you !
>>>>> -- 
>>>>> View this message in context:
>>>>> http://old.nabble.com/CxfExchange-is-not-anymore-available-in-Camel-2.0.0-tp26341178p26341178.html

>>>>>
>>>>> Sent from the Camel Development mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
> 


Mime
View raw message