You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2009/03/22 08:42:59 UTC

Re: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

Hi

Can we get a CfxConstants class/interface containing all the keys end
users need to know about using camel-cxf?

And org.apache.camel.component.cxf.DataFormat.class.getName() isn't the same as
"org.apache.camel.component.cxf.DataFormat" ?

And is there a compelling reason why this key hasn't been migrated to
the new short form Camel 2.0 syntax?


On Sun, Mar 22, 2009 at 5:49 AM, Willem Jiang <wi...@gmail.com> wrote:
> Hi Michael,
>
> You can get the dataFromat info by checking the exchange's property.
> Camel 2.0
> exchange.getProperty(org.apache.camel.component.cxf.DataFormat.class.getName());
>
> For Camel 1.x, you may try to use this
> exchange.getProperty(org.apache.camel.component.cxf.CxfExchange.DATA_FORMAT);
>
> Willem
>
> Michael Ramnarine wrote:
>> Thanks Willem,
>>
>> We were looking to write a custom processor that doesn't know ahead of
>> time which dataFormat the client will be using to access the endpoint.
>>
>> Is there anything on the camel exchange or camel message or cxf message
>> that we can check to at least tell which dataFormat is coming into the
>> custom processor?  I suppose we could check the class type of the
>> exchange.getIn().getBody(), but can you think of a better way?
>>
>> -Mike
>>
>> -----Original Message-----
>> From: Willem Jiang [mailto:willem.jiang@gmail.com]
>> Sent: Friday, March 20, 2009 3:21 AM
>> To: users@camel.apache.org
>> Subject: Re: Questions about camel Exchange that contains a CxfMessage
>> with POJO dataFormat
>>
>> Hi Michael,
>>
>> Since CXF using Stax to handle the XML message , it does not cache the
>> whole xml message when it do the marshaling work.
>>
>> For the POJO Dataformate, you can't get the xml message from the
>> CXFMessage instace, since the inputstream is consumed by the
>> XMLStreamReader.
>>
>> Can I know the reason why are you want to get the xml message even you
>> have the list of the request parameters ?
>>
>> Willem
>>
>> Michael Ramnarine wrote:
>>> One thing I just noticed...
>>> Using getContentFormats() on a POJO CxfMessage for a soap over http
>> endpoint via:
>>>    CxfMessage message = (CxfMessage) exchange.getIn()
>>>    message.getMessage().getContentFormats()
>>>
>>> Returns:
>>>    [interface java.util.List, class java.io.InputStream, interface
>> javax.xml.stream.XMLStreamReader, interface org.w3c.dom.Node]
>>> Will one of these have the original xml message?
>>> How do I use these content formats to get that message in w3c format?
>>
>>> -Mike
>>>
>>> ________________________________________
>>> From: Michael Ramnarine
>>> Sent: Thursday, March 19, 2009 10:46 PM
>>> To: 'users@camel.apache.org'
>>> Subject: Questions about camel Exchange that contains a CxfMessage
>> with POJO dataFormat
>>> Is the original xml message available given a camel Exchange for a
>> soap message that contains a CxfMessage with POJO dataFormat?
>>> Specifically, working in a custom processor, if the inbound message is
>> a CxfMessage with MESSAGE dataFormat, the body is a copy of the original
>> raw message (accessible via exchange.getIn().getBody()).  However, if
>> the inbound message is POJO dataFormat, then getBody() only returns a
>> list containing the Java parameters for the operation being invoked.  Is
>> there anyway to get at the raw xml message when the inbound message is
>> in POJO dataFormat?
>>> Also, is there a way to determine the dataFormat (MESSAGE, PAYLOAD, or
>> POJO) from the camel Exchange or CxfMessage?
>>> -Mike
>>>
>>>
>>
>>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

Posted by William Tam <em...@gmail.com>.
https://issues.apache.org/activemq/browse/CAMEL-1476


On Sun, Mar 22, 2009 at 10:29 AM, William Tam <em...@gmail.com> wrote:
> Hi,
>
> I think the DATA_FORMAT property in the exchange was not intended to
> be used outside CXF component before.   In 1.x, the DATA_FORMAT was
> only set by the CXF producer and not by the consumer.  So, if we are
> going to make it "public", we should set it in both side to be useful.
>  I agree that 2.x should use DATA_FORMAT in CxfConstants rather than
> DataFormat.class.getName().  I'll fire a Jira.
>
> Cheers,
> William
>
> On Sun, Mar 22, 2009 at 3:42 AM, Claus Ibsen <cl...@gmail.com> wrote:
>> Hi
>>
>> Can we get a CfxConstants class/interface containing all the keys end
>> users need to know about using camel-cxf?
>>
>> And org.apache.camel.component.cxf.DataFormat.class.getName() isn't the same as
>> "org.apache.camel.component.cxf.DataFormat" ?
>>
>> And is there a compelling reason why this key hasn't been migrated to
>> the new short form Camel 2.0 syntax?
>>
>>
>> On Sun, Mar 22, 2009 at 5:49 AM, Willem Jiang <wi...@gmail.com> wrote:
>>> Hi Michael,
>>>
>>> You can get the dataFromat info by checking the exchange's property.
>>> Camel 2.0
>>> exchange.getProperty(org.apache.camel.component.cxf.DataFormat.class.getName());
>>>
>>> For Camel 1.x, you may try to use this
>>> exchange.getProperty(org.apache.camel.component.cxf.CxfExchange.DATA_FORMAT);
>>>
>>> Willem
>>>
>>> Michael Ramnarine wrote:
>>>> Thanks Willem,
>>>>
>>>> We were looking to write a custom processor that doesn't know ahead of
>>>> time which dataFormat the client will be using to access the endpoint.
>>>>
>>>> Is there anything on the camel exchange or camel message or cxf message
>>>> that we can check to at least tell which dataFormat is coming into the
>>>> custom processor?  I suppose we could check the class type of the
>>>> exchange.getIn().getBody(), but can you think of a better way?
>>>>
>>>> -Mike
>>>>
>>>> -----Original Message-----
>>>> From: Willem Jiang [mailto:willem.jiang@gmail.com]
>>>> Sent: Friday, March 20, 2009 3:21 AM
>>>> To: users@camel.apache.org
>>>> Subject: Re: Questions about camel Exchange that contains a CxfMessage
>>>> with POJO dataFormat
>>>>
>>>> Hi Michael,
>>>>
>>>> Since CXF using Stax to handle the XML message , it does not cache the
>>>> whole xml message when it do the marshaling work.
>>>>
>>>> For the POJO Dataformate, you can't get the xml message from the
>>>> CXFMessage instace, since the inputstream is consumed by the
>>>> XMLStreamReader.
>>>>
>>>> Can I know the reason why are you want to get the xml message even you
>>>> have the list of the request parameters ?
>>>>
>>>> Willem
>>>>
>>>> Michael Ramnarine wrote:
>>>>> One thing I just noticed...
>>>>> Using getContentFormats() on a POJO CxfMessage for a soap over http
>>>> endpoint via:
>>>>>    CxfMessage message = (CxfMessage) exchange.getIn()
>>>>>    message.getMessage().getContentFormats()
>>>>>
>>>>> Returns:
>>>>>    [interface java.util.List, class java.io.InputStream, interface
>>>> javax.xml.stream.XMLStreamReader, interface org.w3c.dom.Node]
>>>>> Will one of these have the original xml message?
>>>>> How do I use these content formats to get that message in w3c format?
>>>>
>>>>> -Mike
>>>>>
>>>>> ________________________________________
>>>>> From: Michael Ramnarine
>>>>> Sent: Thursday, March 19, 2009 10:46 PM
>>>>> To: 'users@camel.apache.org'
>>>>> Subject: Questions about camel Exchange that contains a CxfMessage
>>>> with POJO dataFormat
>>>>> Is the original xml message available given a camel Exchange for a
>>>> soap message that contains a CxfMessage with POJO dataFormat?
>>>>> Specifically, working in a custom processor, if the inbound message is
>>>> a CxfMessage with MESSAGE dataFormat, the body is a copy of the original
>>>> raw message (accessible via exchange.getIn().getBody()).  However, if
>>>> the inbound message is POJO dataFormat, then getBody() only returns a
>>>> list containing the Java parameters for the operation being invoked.  Is
>>>> there anyway to get at the raw xml message when the inbound message is
>>>> in POJO dataFormat?
>>>>> Also, is there a way to determine the dataFormat (MESSAGE, PAYLOAD, or
>>>> POJO) from the camel Exchange or CxfMessage?
>>>>> -Mike
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>>
>

Re: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

Posted by William Tam <em...@gmail.com>.
Hi Mike,

It should be fixed now.

Cheers,
William

On Mon, Mar 23, 2009 at 6:57 PM, Michael Ramnarine
<MR...@progress.com> wrote:
> OK, I tried out the fix and it looks good.  Thanks!
>
> One thing though, when using POJO dataFormat, for example:
>        <cxf:properties>
>            <entry key="dataFormat" value="POJO" />
>        </cxf:properties>
> getProperty(DATA_FORMAT_PROPERTY) returns: null
>
> This is in a custom processor calling:
> exchange.getProperty(org.apache.camel.component.cxf.CxfConstants.DATA_FORMAT_PROPERTY);
>
> If configured for MESSAGE, the result of the above code is: MESSAGE
> And similarly for PAYLOAD, the result of the above code is: PAYLOAD
> But for POJO, the result is: null
>
> It looks like the call in CamelInvoker.invoke(exchange) to CxfEndpointUtils.getDataFormat(endpoint) must return null for POJO mode.
>
> -Mike
>
> -----Original Message-----
> From: Michael Ramnarine [mailto:MRAMNARI@progress.com]
> Sent: Monday, March 23, 2009 12:22 AM
> To: users@camel.apache.org
> Subject: RE: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat
>
> Thanks guys. William I saw your commits for CAMEL-1476 - that looks like just what was needed to provide a CamelCXFDataFormat property on the camel exchange, on the consumer side.  I will try to setup a test case tomorrow to verify the fix.
>
> -Mike
>
> -----Original Message-----
> From: William Tam [mailto:email.wtam@gmail.com]
> Sent: Sunday, March 22, 2009 11:14 PM
> To: users@camel.apache.org
> Subject: Re: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat
>
> I mis-read Claus email.   Also, I thought the short form was only
> applied to header names.  Is it applied to both header and property
> names?  I'll go change it then.  thanks.
>
> On Sun, Mar 22, 2009 at 9:04 PM, Willem Jiang <wi...@gmail.com> wrote:
>> Hi William,
>>
>> Just as Claus said, can we use the Camel 2.0 syntax to specify the data
>> format name? Like this
>>  String DATA_FORMAT_PROPERTY = "CamelCXFDataFormat";
>> It is because we use it in Camel, and it could make Exchange property
>> JMS friendly.
>>
>> And We keep use the constant of DATA_FORMAT_PROPERTY in Camel 1.x.
>>
>>
>> Willem
>>
>>
>> William Tam wrote:
>>> Hi,
>>>
>>> I think the DATA_FORMAT property in the exchange was not intended to
>>> be used outside CXF component before.   In 1.x, the DATA_FORMAT was
>>> only set by the CXF producer and not by the consumer.  So, if we are
>>> going to make it "public", we should set it in both side to be useful.
>>>   I agree that 2.x should use DATA_FORMAT in CxfConstants rather than
>>> DataFormat.class.getName().  I'll fire a Jira.
>>>
>>> Cheers,
>>> William
>>>
>>> On Sun, Mar 22, 2009 at 3:42 AM, Claus Ibsen <cl...@gmail.com> wrote:
>>>> Hi
>>>>
>>>> Can we get a CfxConstants class/interface containing all the keys end
>>>> users need to know about using camel-cxf?
>>>>
>>>> And org.apache.camel.component.cxf.DataFormat.class.getName() isn't the same as
>>>> "org.apache.camel.component.cxf.DataFormat" ?
>>>>
>>>> And is there a compelling reason why this key hasn't been migrated to
>>>> the new short form Camel 2.0 syntax?
>>>>
>>>>
>>>> On Sun, Mar 22, 2009 at 5:49 AM, Willem Jiang <wi...@gmail.com> wrote:
>>>>> Hi Michael,
>>>>>
>>>>> You can get the dataFromat info by checking the exchange's property.
>>>>> Camel 2.0
>>>>> exchange.getProperty(org.apache.camel.component.cxf.DataFormat.class.getName());
>>>>>
>>>>> For Camel 1.x, you may try to use this
>>>>> exchange.getProperty(org.apache.camel.component.cxf.CxfExchange.DATA_FORMAT);
>>>>>
>>>>> Willem
>>>>>
>>>>> Michael Ramnarine wrote:
>>>>>> Thanks Willem,
>>>>>>
>>>>>> We were looking to write a custom processor that doesn't know ahead of
>>>>>> time which dataFormat the client will be using to access the endpoint.
>>>>>>
>>>>>> Is there anything on the camel exchange or camel message or cxf message
>>>>>> that we can check to at least tell which dataFormat is coming into the
>>>>>> custom processor?  I suppose we could check the class type of the
>>>>>> exchange.getIn().getBody(), but can you think of a better way?
>>>>>>
>>>>>> -Mike
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Willem Jiang [mailto:willem.jiang@gmail.com]
>>>>>> Sent: Friday, March 20, 2009 3:21 AM
>>>>>> To: users@camel.apache.org
>>>>>> Subject: Re: Questions about camel Exchange that contains a CxfMessage
>>>>>> with POJO dataFormat
>>>>>>
>>>>>> Hi Michael,
>>>>>>
>>>>>> Since CXF using Stax to handle the XML message , it does not cache the
>>>>>> whole xml message when it do the marshaling work.
>>>>>>
>>>>>> For the POJO Dataformate, you can't get the xml message from the
>>>>>> CXFMessage instace, since the inputstream is consumed by the
>>>>>> XMLStreamReader.
>>>>>>
>>>>>> Can I know the reason why are you want to get the xml message even you
>>>>>> have the list of the request parameters ?
>>>>>>
>>>>>> Willem
>>>>>>
>>>>>> Michael Ramnarine wrote:
>>>>>>> One thing I just noticed...
>>>>>>> Using getContentFormats() on a POJO CxfMessage for a soap over http
>>>>>> endpoint via:
>>>>>>>    CxfMessage message = (CxfMessage) exchange.getIn()
>>>>>>>    message.getMessage().getContentFormats()
>>>>>>>
>>>>>>> Returns:
>>>>>>>    [interface java.util.List, class java.io.InputStream, interface
>>>>>> javax.xml.stream.XMLStreamReader, interface org.w3c.dom.Node]
>>>>>>> Will one of these have the original xml message?
>>>>>>> How do I use these content formats to get that message in w3c format?
>>>>>>> -Mike
>>>>>>>
>>>>>>> ________________________________________
>>>>>>> From: Michael Ramnarine
>>>>>>> Sent: Thursday, March 19, 2009 10:46 PM
>>>>>>> To: 'users@camel.apache.org'
>>>>>>> Subject: Questions about camel Exchange that contains a CxfMessage
>>>>>> with POJO dataFormat
>>>>>>> Is the original xml message available given a camel Exchange for a
>>>>>> soap message that contains a CxfMessage with POJO dataFormat?
>>>>>>> Specifically, working in a custom processor, if the inbound message is
>>>>>> a CxfMessage with MESSAGE dataFormat, the body is a copy of the original
>>>>>> raw message (accessible via exchange.getIn().getBody()).  However, if
>>>>>> the inbound message is POJO dataFormat, then getBody() only returns a
>>>>>> list containing the Java parameters for the operation being invoked.  Is
>>>>>> there anyway to get at the raw xml message when the inbound message is
>>>>>> in POJO dataFormat?
>>>>>>> Also, is there a way to determine the dataFormat (MESSAGE, PAYLOAD, or
>>>>>> POJO) from the camel Exchange or CxfMessage?
>>>>>>> -Mike
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>>
>>>
>>
>>
>

RE: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

Posted by Michael Ramnarine <MR...@progress.com>.
OK, I tried out the fix and it looks good.  Thanks!

One thing though, when using POJO dataFormat, for example:
        <cxf:properties>
            <entry key="dataFormat" value="POJO" />
        </cxf:properties>
getProperty(DATA_FORMAT_PROPERTY) returns: null

This is in a custom processor calling:
exchange.getProperty(org.apache.camel.component.cxf.CxfConstants.DATA_FORMAT_PROPERTY);

If configured for MESSAGE, the result of the above code is: MESSAGE 
And similarly for PAYLOAD, the result of the above code is: PAYLOAD
But for POJO, the result is: null

It looks like the call in CamelInvoker.invoke(exchange) to CxfEndpointUtils.getDataFormat(endpoint) must return null for POJO mode.

-Mike

-----Original Message-----
From: Michael Ramnarine [mailto:MRAMNARI@progress.com] 
Sent: Monday, March 23, 2009 12:22 AM
To: users@camel.apache.org
Subject: RE: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

Thanks guys. William I saw your commits for CAMEL-1476 - that looks like just what was needed to provide a CamelCXFDataFormat property on the camel exchange, on the consumer side.  I will try to setup a test case tomorrow to verify the fix.

-Mike

-----Original Message-----
From: William Tam [mailto:email.wtam@gmail.com] 
Sent: Sunday, March 22, 2009 11:14 PM
To: users@camel.apache.org
Subject: Re: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

I mis-read Claus email.   Also, I thought the short form was only
applied to header names.  Is it applied to both header and property
names?  I'll go change it then.  thanks.

On Sun, Mar 22, 2009 at 9:04 PM, Willem Jiang <wi...@gmail.com> wrote:
> Hi William,
>
> Just as Claus said, can we use the Camel 2.0 syntax to specify the data
> format name? Like this
>  String DATA_FORMAT_PROPERTY = "CamelCXFDataFormat";
> It is because we use it in Camel, and it could make Exchange property
> JMS friendly.
>
> And We keep use the constant of DATA_FORMAT_PROPERTY in Camel 1.x.
>
>
> Willem
>
>
> William Tam wrote:
>> Hi,
>>
>> I think the DATA_FORMAT property in the exchange was not intended to
>> be used outside CXF component before.   In 1.x, the DATA_FORMAT was
>> only set by the CXF producer and not by the consumer.  So, if we are
>> going to make it "public", we should set it in both side to be useful.
>>   I agree that 2.x should use DATA_FORMAT in CxfConstants rather than
>> DataFormat.class.getName().  I'll fire a Jira.
>>
>> Cheers,
>> William
>>
>> On Sun, Mar 22, 2009 at 3:42 AM, Claus Ibsen <cl...@gmail.com> wrote:
>>> Hi
>>>
>>> Can we get a CfxConstants class/interface containing all the keys end
>>> users need to know about using camel-cxf?
>>>
>>> And org.apache.camel.component.cxf.DataFormat.class.getName() isn't the same as
>>> "org.apache.camel.component.cxf.DataFormat" ?
>>>
>>> And is there a compelling reason why this key hasn't been migrated to
>>> the new short form Camel 2.0 syntax?
>>>
>>>
>>> On Sun, Mar 22, 2009 at 5:49 AM, Willem Jiang <wi...@gmail.com> wrote:
>>>> Hi Michael,
>>>>
>>>> You can get the dataFromat info by checking the exchange's property.
>>>> Camel 2.0
>>>> exchange.getProperty(org.apache.camel.component.cxf.DataFormat.class.getName());
>>>>
>>>> For Camel 1.x, you may try to use this
>>>> exchange.getProperty(org.apache.camel.component.cxf.CxfExchange.DATA_FORMAT);
>>>>
>>>> Willem
>>>>
>>>> Michael Ramnarine wrote:
>>>>> Thanks Willem,
>>>>>
>>>>> We were looking to write a custom processor that doesn't know ahead of
>>>>> time which dataFormat the client will be using to access the endpoint.
>>>>>
>>>>> Is there anything on the camel exchange or camel message or cxf message
>>>>> that we can check to at least tell which dataFormat is coming into the
>>>>> custom processor?  I suppose we could check the class type of the
>>>>> exchange.getIn().getBody(), but can you think of a better way?
>>>>>
>>>>> -Mike
>>>>>
>>>>> -----Original Message-----
>>>>> From: Willem Jiang [mailto:willem.jiang@gmail.com]
>>>>> Sent: Friday, March 20, 2009 3:21 AM
>>>>> To: users@camel.apache.org
>>>>> Subject: Re: Questions about camel Exchange that contains a CxfMessage
>>>>> with POJO dataFormat
>>>>>
>>>>> Hi Michael,
>>>>>
>>>>> Since CXF using Stax to handle the XML message , it does not cache the
>>>>> whole xml message when it do the marshaling work.
>>>>>
>>>>> For the POJO Dataformate, you can't get the xml message from the
>>>>> CXFMessage instace, since the inputstream is consumed by the
>>>>> XMLStreamReader.
>>>>>
>>>>> Can I know the reason why are you want to get the xml message even you
>>>>> have the list of the request parameters ?
>>>>>
>>>>> Willem
>>>>>
>>>>> Michael Ramnarine wrote:
>>>>>> One thing I just noticed...
>>>>>> Using getContentFormats() on a POJO CxfMessage for a soap over http
>>>>> endpoint via:
>>>>>>    CxfMessage message = (CxfMessage) exchange.getIn()
>>>>>>    message.getMessage().getContentFormats()
>>>>>>
>>>>>> Returns:
>>>>>>    [interface java.util.List, class java.io.InputStream, interface
>>>>> javax.xml.stream.XMLStreamReader, interface org.w3c.dom.Node]
>>>>>> Will one of these have the original xml message?
>>>>>> How do I use these content formats to get that message in w3c format?
>>>>>> -Mike
>>>>>>
>>>>>> ________________________________________
>>>>>> From: Michael Ramnarine
>>>>>> Sent: Thursday, March 19, 2009 10:46 PM
>>>>>> To: 'users@camel.apache.org'
>>>>>> Subject: Questions about camel Exchange that contains a CxfMessage
>>>>> with POJO dataFormat
>>>>>> Is the original xml message available given a camel Exchange for a
>>>>> soap message that contains a CxfMessage with POJO dataFormat?
>>>>>> Specifically, working in a custom processor, if the inbound message is
>>>>> a CxfMessage with MESSAGE dataFormat, the body is a copy of the original
>>>>> raw message (accessible via exchange.getIn().getBody()).  However, if
>>>>> the inbound message is POJO dataFormat, then getBody() only returns a
>>>>> list containing the Java parameters for the operation being invoked.  Is
>>>>> there anyway to get at the raw xml message when the inbound message is
>>>>> in POJO dataFormat?
>>>>>> Also, is there a way to determine the dataFormat (MESSAGE, PAYLOAD, or
>>>>> POJO) from the camel Exchange or CxfMessage?
>>>>>> -Mike
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>>
>>
>
>

RE: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

Posted by Michael Ramnarine <MR...@progress.com>.
Thanks guys. William I saw your commits for CAMEL-1476 - that looks like just what was needed to provide a CamelCXFDataFormat property on the camel exchange, on the consumer side.  I will try to setup a test case tomorrow to verify the fix.

-Mike

-----Original Message-----
From: William Tam [mailto:email.wtam@gmail.com] 
Sent: Sunday, March 22, 2009 11:14 PM
To: users@camel.apache.org
Subject: Re: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

I mis-read Claus email.   Also, I thought the short form was only
applied to header names.  Is it applied to both header and property
names?  I'll go change it then.  thanks.

On Sun, Mar 22, 2009 at 9:04 PM, Willem Jiang <wi...@gmail.com> wrote:
> Hi William,
>
> Just as Claus said, can we use the Camel 2.0 syntax to specify the data
> format name? Like this
>  String DATA_FORMAT_PROPERTY = "CamelCXFDataFormat";
> It is because we use it in Camel, and it could make Exchange property
> JMS friendly.
>
> And We keep use the constant of DATA_FORMAT_PROPERTY in Camel 1.x.
>
>
> Willem
>
>
> William Tam wrote:
>> Hi,
>>
>> I think the DATA_FORMAT property in the exchange was not intended to
>> be used outside CXF component before.   In 1.x, the DATA_FORMAT was
>> only set by the CXF producer and not by the consumer.  So, if we are
>> going to make it "public", we should set it in both side to be useful.
>>   I agree that 2.x should use DATA_FORMAT in CxfConstants rather than
>> DataFormat.class.getName().  I'll fire a Jira.
>>
>> Cheers,
>> William
>>
>> On Sun, Mar 22, 2009 at 3:42 AM, Claus Ibsen <cl...@gmail.com> wrote:
>>> Hi
>>>
>>> Can we get a CfxConstants class/interface containing all the keys end
>>> users need to know about using camel-cxf?
>>>
>>> And org.apache.camel.component.cxf.DataFormat.class.getName() isn't the same as
>>> "org.apache.camel.component.cxf.DataFormat" ?
>>>
>>> And is there a compelling reason why this key hasn't been migrated to
>>> the new short form Camel 2.0 syntax?
>>>
>>>
>>> On Sun, Mar 22, 2009 at 5:49 AM, Willem Jiang <wi...@gmail.com> wrote:
>>>> Hi Michael,
>>>>
>>>> You can get the dataFromat info by checking the exchange's property.
>>>> Camel 2.0
>>>> exchange.getProperty(org.apache.camel.component.cxf.DataFormat.class.getName());
>>>>
>>>> For Camel 1.x, you may try to use this
>>>> exchange.getProperty(org.apache.camel.component.cxf.CxfExchange.DATA_FORMAT);
>>>>
>>>> Willem
>>>>
>>>> Michael Ramnarine wrote:
>>>>> Thanks Willem,
>>>>>
>>>>> We were looking to write a custom processor that doesn't know ahead of
>>>>> time which dataFormat the client will be using to access the endpoint.
>>>>>
>>>>> Is there anything on the camel exchange or camel message or cxf message
>>>>> that we can check to at least tell which dataFormat is coming into the
>>>>> custom processor?  I suppose we could check the class type of the
>>>>> exchange.getIn().getBody(), but can you think of a better way?
>>>>>
>>>>> -Mike
>>>>>
>>>>> -----Original Message-----
>>>>> From: Willem Jiang [mailto:willem.jiang@gmail.com]
>>>>> Sent: Friday, March 20, 2009 3:21 AM
>>>>> To: users@camel.apache.org
>>>>> Subject: Re: Questions about camel Exchange that contains a CxfMessage
>>>>> with POJO dataFormat
>>>>>
>>>>> Hi Michael,
>>>>>
>>>>> Since CXF using Stax to handle the XML message , it does not cache the
>>>>> whole xml message when it do the marshaling work.
>>>>>
>>>>> For the POJO Dataformate, you can't get the xml message from the
>>>>> CXFMessage instace, since the inputstream is consumed by the
>>>>> XMLStreamReader.
>>>>>
>>>>> Can I know the reason why are you want to get the xml message even you
>>>>> have the list of the request parameters ?
>>>>>
>>>>> Willem
>>>>>
>>>>> Michael Ramnarine wrote:
>>>>>> One thing I just noticed...
>>>>>> Using getContentFormats() on a POJO CxfMessage for a soap over http
>>>>> endpoint via:
>>>>>>    CxfMessage message = (CxfMessage) exchange.getIn()
>>>>>>    message.getMessage().getContentFormats()
>>>>>>
>>>>>> Returns:
>>>>>>    [interface java.util.List, class java.io.InputStream, interface
>>>>> javax.xml.stream.XMLStreamReader, interface org.w3c.dom.Node]
>>>>>> Will one of these have the original xml message?
>>>>>> How do I use these content formats to get that message in w3c format?
>>>>>> -Mike
>>>>>>
>>>>>> ________________________________________
>>>>>> From: Michael Ramnarine
>>>>>> Sent: Thursday, March 19, 2009 10:46 PM
>>>>>> To: 'users@camel.apache.org'
>>>>>> Subject: Questions about camel Exchange that contains a CxfMessage
>>>>> with POJO dataFormat
>>>>>> Is the original xml message available given a camel Exchange for a
>>>>> soap message that contains a CxfMessage with POJO dataFormat?
>>>>>> Specifically, working in a custom processor, if the inbound message is
>>>>> a CxfMessage with MESSAGE dataFormat, the body is a copy of the original
>>>>> raw message (accessible via exchange.getIn().getBody()).  However, if
>>>>> the inbound message is POJO dataFormat, then getBody() only returns a
>>>>> list containing the Java parameters for the operation being invoked.  Is
>>>>> there anyway to get at the raw xml message when the inbound message is
>>>>> in POJO dataFormat?
>>>>>> Also, is there a way to determine the dataFormat (MESSAGE, PAYLOAD, or
>>>>> POJO) from the camel Exchange or CxfMessage?
>>>>>> -Mike
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>>
>>
>
>

Re: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

Posted by William Tam <em...@gmail.com>.
I mis-read Claus email.   Also, I thought the short form was only
applied to header names.  Is it applied to both header and property
names?  I'll go change it then.  thanks.

On Sun, Mar 22, 2009 at 9:04 PM, Willem Jiang <wi...@gmail.com> wrote:
> Hi William,
>
> Just as Claus said, can we use the Camel 2.0 syntax to specify the data
> format name? Like this
>  String DATA_FORMAT_PROPERTY = "CamelCXFDataFormat";
> It is because we use it in Camel, and it could make Exchange property
> JMS friendly.
>
> And We keep use the constant of DATA_FORMAT_PROPERTY in Camel 1.x.
>
>
> Willem
>
>
> William Tam wrote:
>> Hi,
>>
>> I think the DATA_FORMAT property in the exchange was not intended to
>> be used outside CXF component before.   In 1.x, the DATA_FORMAT was
>> only set by the CXF producer and not by the consumer.  So, if we are
>> going to make it "public", we should set it in both side to be useful.
>>   I agree that 2.x should use DATA_FORMAT in CxfConstants rather than
>> DataFormat.class.getName().  I'll fire a Jira.
>>
>> Cheers,
>> William
>>
>> On Sun, Mar 22, 2009 at 3:42 AM, Claus Ibsen <cl...@gmail.com> wrote:
>>> Hi
>>>
>>> Can we get a CfxConstants class/interface containing all the keys end
>>> users need to know about using camel-cxf?
>>>
>>> And org.apache.camel.component.cxf.DataFormat.class.getName() isn't the same as
>>> "org.apache.camel.component.cxf.DataFormat" ?
>>>
>>> And is there a compelling reason why this key hasn't been migrated to
>>> the new short form Camel 2.0 syntax?
>>>
>>>
>>> On Sun, Mar 22, 2009 at 5:49 AM, Willem Jiang <wi...@gmail.com> wrote:
>>>> Hi Michael,
>>>>
>>>> You can get the dataFromat info by checking the exchange's property.
>>>> Camel 2.0
>>>> exchange.getProperty(org.apache.camel.component.cxf.DataFormat.class.getName());
>>>>
>>>> For Camel 1.x, you may try to use this
>>>> exchange.getProperty(org.apache.camel.component.cxf.CxfExchange.DATA_FORMAT);
>>>>
>>>> Willem
>>>>
>>>> Michael Ramnarine wrote:
>>>>> Thanks Willem,
>>>>>
>>>>> We were looking to write a custom processor that doesn't know ahead of
>>>>> time which dataFormat the client will be using to access the endpoint.
>>>>>
>>>>> Is there anything on the camel exchange or camel message or cxf message
>>>>> that we can check to at least tell which dataFormat is coming into the
>>>>> custom processor?  I suppose we could check the class type of the
>>>>> exchange.getIn().getBody(), but can you think of a better way?
>>>>>
>>>>> -Mike
>>>>>
>>>>> -----Original Message-----
>>>>> From: Willem Jiang [mailto:willem.jiang@gmail.com]
>>>>> Sent: Friday, March 20, 2009 3:21 AM
>>>>> To: users@camel.apache.org
>>>>> Subject: Re: Questions about camel Exchange that contains a CxfMessage
>>>>> with POJO dataFormat
>>>>>
>>>>> Hi Michael,
>>>>>
>>>>> Since CXF using Stax to handle the XML message , it does not cache the
>>>>> whole xml message when it do the marshaling work.
>>>>>
>>>>> For the POJO Dataformate, you can't get the xml message from the
>>>>> CXFMessage instace, since the inputstream is consumed by the
>>>>> XMLStreamReader.
>>>>>
>>>>> Can I know the reason why are you want to get the xml message even you
>>>>> have the list of the request parameters ?
>>>>>
>>>>> Willem
>>>>>
>>>>> Michael Ramnarine wrote:
>>>>>> One thing I just noticed...
>>>>>> Using getContentFormats() on a POJO CxfMessage for a soap over http
>>>>> endpoint via:
>>>>>>    CxfMessage message = (CxfMessage) exchange.getIn()
>>>>>>    message.getMessage().getContentFormats()
>>>>>>
>>>>>> Returns:
>>>>>>    [interface java.util.List, class java.io.InputStream, interface
>>>>> javax.xml.stream.XMLStreamReader, interface org.w3c.dom.Node]
>>>>>> Will one of these have the original xml message?
>>>>>> How do I use these content formats to get that message in w3c format?
>>>>>> -Mike
>>>>>>
>>>>>> ________________________________________
>>>>>> From: Michael Ramnarine
>>>>>> Sent: Thursday, March 19, 2009 10:46 PM
>>>>>> To: 'users@camel.apache.org'
>>>>>> Subject: Questions about camel Exchange that contains a CxfMessage
>>>>> with POJO dataFormat
>>>>>> Is the original xml message available given a camel Exchange for a
>>>>> soap message that contains a CxfMessage with POJO dataFormat?
>>>>>> Specifically, working in a custom processor, if the inbound message is
>>>>> a CxfMessage with MESSAGE dataFormat, the body is a copy of the original
>>>>> raw message (accessible via exchange.getIn().getBody()).  However, if
>>>>> the inbound message is POJO dataFormat, then getBody() only returns a
>>>>> list containing the Java parameters for the operation being invoked.  Is
>>>>> there anyway to get at the raw xml message when the inbound message is
>>>>> in POJO dataFormat?
>>>>>> Also, is there a way to determine the dataFormat (MESSAGE, PAYLOAD, or
>>>>> POJO) from the camel Exchange or CxfMessage?
>>>>>> -Mike
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>>
>>
>
>

Re: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

Posted by Willem Jiang <wi...@gmail.com>.
Hi William,

Just as Claus said, can we use the Camel 2.0 syntax to specify the data
format name? Like this
 String DATA_FORMAT_PROPERTY = "CamelCXFDataFormat";
It is because we use it in Camel, and it could make Exchange property
JMS friendly.

And We keep use the constant of DATA_FORMAT_PROPERTY in Camel 1.x.


Willem


William Tam wrote:
> Hi,
> 
> I think the DATA_FORMAT property in the exchange was not intended to
> be used outside CXF component before.   In 1.x, the DATA_FORMAT was
> only set by the CXF producer and not by the consumer.  So, if we are
> going to make it "public", we should set it in both side to be useful.
>   I agree that 2.x should use DATA_FORMAT in CxfConstants rather than
> DataFormat.class.getName().  I'll fire a Jira.
> 
> Cheers,
> William
> 
> On Sun, Mar 22, 2009 at 3:42 AM, Claus Ibsen <cl...@gmail.com> wrote:
>> Hi
>>
>> Can we get a CfxConstants class/interface containing all the keys end
>> users need to know about using camel-cxf?
>>
>> And org.apache.camel.component.cxf.DataFormat.class.getName() isn't the same as
>> "org.apache.camel.component.cxf.DataFormat" ?
>>
>> And is there a compelling reason why this key hasn't been migrated to
>> the new short form Camel 2.0 syntax?
>>
>>
>> On Sun, Mar 22, 2009 at 5:49 AM, Willem Jiang <wi...@gmail.com> wrote:
>>> Hi Michael,
>>>
>>> You can get the dataFromat info by checking the exchange's property.
>>> Camel 2.0
>>> exchange.getProperty(org.apache.camel.component.cxf.DataFormat.class.getName());
>>>
>>> For Camel 1.x, you may try to use this
>>> exchange.getProperty(org.apache.camel.component.cxf.CxfExchange.DATA_FORMAT);
>>>
>>> Willem
>>>
>>> Michael Ramnarine wrote:
>>>> Thanks Willem,
>>>>
>>>> We were looking to write a custom processor that doesn't know ahead of
>>>> time which dataFormat the client will be using to access the endpoint.
>>>>
>>>> Is there anything on the camel exchange or camel message or cxf message
>>>> that we can check to at least tell which dataFormat is coming into the
>>>> custom processor?  I suppose we could check the class type of the
>>>> exchange.getIn().getBody(), but can you think of a better way?
>>>>
>>>> -Mike
>>>>
>>>> -----Original Message-----
>>>> From: Willem Jiang [mailto:willem.jiang@gmail.com]
>>>> Sent: Friday, March 20, 2009 3:21 AM
>>>> To: users@camel.apache.org
>>>> Subject: Re: Questions about camel Exchange that contains a CxfMessage
>>>> with POJO dataFormat
>>>>
>>>> Hi Michael,
>>>>
>>>> Since CXF using Stax to handle the XML message , it does not cache the
>>>> whole xml message when it do the marshaling work.
>>>>
>>>> For the POJO Dataformate, you can't get the xml message from the
>>>> CXFMessage instace, since the inputstream is consumed by the
>>>> XMLStreamReader.
>>>>
>>>> Can I know the reason why are you want to get the xml message even you
>>>> have the list of the request parameters ?
>>>>
>>>> Willem
>>>>
>>>> Michael Ramnarine wrote:
>>>>> One thing I just noticed...
>>>>> Using getContentFormats() on a POJO CxfMessage for a soap over http
>>>> endpoint via:
>>>>>    CxfMessage message = (CxfMessage) exchange.getIn()
>>>>>    message.getMessage().getContentFormats()
>>>>>
>>>>> Returns:
>>>>>    [interface java.util.List, class java.io.InputStream, interface
>>>> javax.xml.stream.XMLStreamReader, interface org.w3c.dom.Node]
>>>>> Will one of these have the original xml message?
>>>>> How do I use these content formats to get that message in w3c format?
>>>>> -Mike
>>>>>
>>>>> ________________________________________
>>>>> From: Michael Ramnarine
>>>>> Sent: Thursday, March 19, 2009 10:46 PM
>>>>> To: 'users@camel.apache.org'
>>>>> Subject: Questions about camel Exchange that contains a CxfMessage
>>>> with POJO dataFormat
>>>>> Is the original xml message available given a camel Exchange for a
>>>> soap message that contains a CxfMessage with POJO dataFormat?
>>>>> Specifically, working in a custom processor, if the inbound message is
>>>> a CxfMessage with MESSAGE dataFormat, the body is a copy of the original
>>>> raw message (accessible via exchange.getIn().getBody()).  However, if
>>>> the inbound message is POJO dataFormat, then getBody() only returns a
>>>> list containing the Java parameters for the operation being invoked.  Is
>>>> there anyway to get at the raw xml message when the inbound message is
>>>> in POJO dataFormat?
>>>>> Also, is there a way to determine the dataFormat (MESSAGE, PAYLOAD, or
>>>> POJO) from the camel Exchange or CxfMessage?
>>>>> -Mike
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>>
> 


Re: Questions about camel Exchange that contains a CxfMessage with POJO dataFormat

Posted by William Tam <em...@gmail.com>.
Hi,

I think the DATA_FORMAT property in the exchange was not intended to
be used outside CXF component before.   In 1.x, the DATA_FORMAT was
only set by the CXF producer and not by the consumer.  So, if we are
going to make it "public", we should set it in both side to be useful.
  I agree that 2.x should use DATA_FORMAT in CxfConstants rather than
DataFormat.class.getName().  I'll fire a Jira.

Cheers,
William

On Sun, Mar 22, 2009 at 3:42 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Can we get a CfxConstants class/interface containing all the keys end
> users need to know about using camel-cxf?
>
> And org.apache.camel.component.cxf.DataFormat.class.getName() isn't the same as
> "org.apache.camel.component.cxf.DataFormat" ?
>
> And is there a compelling reason why this key hasn't been migrated to
> the new short form Camel 2.0 syntax?
>
>
> On Sun, Mar 22, 2009 at 5:49 AM, Willem Jiang <wi...@gmail.com> wrote:
>> Hi Michael,
>>
>> You can get the dataFromat info by checking the exchange's property.
>> Camel 2.0
>> exchange.getProperty(org.apache.camel.component.cxf.DataFormat.class.getName());
>>
>> For Camel 1.x, you may try to use this
>> exchange.getProperty(org.apache.camel.component.cxf.CxfExchange.DATA_FORMAT);
>>
>> Willem
>>
>> Michael Ramnarine wrote:
>>> Thanks Willem,
>>>
>>> We were looking to write a custom processor that doesn't know ahead of
>>> time which dataFormat the client will be using to access the endpoint.
>>>
>>> Is there anything on the camel exchange or camel message or cxf message
>>> that we can check to at least tell which dataFormat is coming into the
>>> custom processor?  I suppose we could check the class type of the
>>> exchange.getIn().getBody(), but can you think of a better way?
>>>
>>> -Mike
>>>
>>> -----Original Message-----
>>> From: Willem Jiang [mailto:willem.jiang@gmail.com]
>>> Sent: Friday, March 20, 2009 3:21 AM
>>> To: users@camel.apache.org
>>> Subject: Re: Questions about camel Exchange that contains a CxfMessage
>>> with POJO dataFormat
>>>
>>> Hi Michael,
>>>
>>> Since CXF using Stax to handle the XML message , it does not cache the
>>> whole xml message when it do the marshaling work.
>>>
>>> For the POJO Dataformate, you can't get the xml message from the
>>> CXFMessage instace, since the inputstream is consumed by the
>>> XMLStreamReader.
>>>
>>> Can I know the reason why are you want to get the xml message even you
>>> have the list of the request parameters ?
>>>
>>> Willem
>>>
>>> Michael Ramnarine wrote:
>>>> One thing I just noticed...
>>>> Using getContentFormats() on a POJO CxfMessage for a soap over http
>>> endpoint via:
>>>>    CxfMessage message = (CxfMessage) exchange.getIn()
>>>>    message.getMessage().getContentFormats()
>>>>
>>>> Returns:
>>>>    [interface java.util.List, class java.io.InputStream, interface
>>> javax.xml.stream.XMLStreamReader, interface org.w3c.dom.Node]
>>>> Will one of these have the original xml message?
>>>> How do I use these content formats to get that message in w3c format?
>>>
>>>> -Mike
>>>>
>>>> ________________________________________
>>>> From: Michael Ramnarine
>>>> Sent: Thursday, March 19, 2009 10:46 PM
>>>> To: 'users@camel.apache.org'
>>>> Subject: Questions about camel Exchange that contains a CxfMessage
>>> with POJO dataFormat
>>>> Is the original xml message available given a camel Exchange for a
>>> soap message that contains a CxfMessage with POJO dataFormat?
>>>> Specifically, working in a custom processor, if the inbound message is
>>> a CxfMessage with MESSAGE dataFormat, the body is a copy of the original
>>> raw message (accessible via exchange.getIn().getBody()).  However, if
>>> the inbound message is POJO dataFormat, then getBody() only returns a
>>> list containing the Java parameters for the operation being invoked.  Is
>>> there anyway to get at the raw xml message when the inbound message is
>>> in POJO dataFormat?
>>>> Also, is there a way to determine the dataFormat (MESSAGE, PAYLOAD, or
>>> POJO) from the camel Exchange or CxfMessage?
>>>> -Mike
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>