You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Olivier Roger <ol...@bsb.com> on 2010/04/14 12:17:46 UTC

[CXF] Inbound endpoint with PAYLOAD dataformat

Hello Camel,

I am experimenting a strange issue when using CXF inbound endpoint with
PAYLOAD dataformat option (no problem in MESSAGE mode).

First I declare a CXF endpoint:

	<cxf:cxfEndpoint id="F1" address="http://localhost:10101/F1"
serviceClass="CXFUseCase"> <!-- Interface with one method -->
		<cxf:dataBinding>
			<bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding" />
		</cxf:dataBinding>
		<cxf:properties>
			<entry key="dataFormat" value="PAYLOAD"/>
		</cxf:properties>
	</cxf:cxfEndpoint>

Then, in my route I use it:

		<route>
			<from uri="cxf:bean:F1" />
			<bean ref="inspect" />

When I debug in the inspect bean the Exchange object does not contain any
value.
However, setting a response value works correctly.

    public void process(final Exchange exchange){
    	String msg = exchange.getIn().getBody(String.class);
    	System.out.println(msg); // is null
    	exchange.getOut().setBody(createResponse(), PersonDocument.class); //
is ok
    }

I read the documentation on the website but found it quite not clear. Am I
doing something wrong?

Thanks in advance,

Olivier
-- 
View this message in context: http://old.nabble.com/-CXF--Inbound-endpoint-with-PAYLOAD-dataformat-tp28240799p28240799.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: [CXF] Inbound endpoint with PAYLOAD dataformat

Posted by Olivier Roger <ol...@bsb.com>.
I did not specify it but here is the message I try to send:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:esb="http://www.bsb.com/incubator/esb">
   <soapenv:Header/>
   <soapenv:Body>
      <esb:GetPerson>
         <socialId>528404-885-24</socialId>
      </esb:GetPerson>
   </soapenv:Body>
</soapenv:Envelope>

I am not sure it helps though...


Olivier Roger wrote:
> 
> I remove the xmlbeans usage to use an interface using String as input and
> output parameter types.
> 
> package com.bsb.incubator.esb.fuse4;
> 
> import javax.jws.WebParam;
> import javax.jws.WebService;
> 
> @WebService(targetNamespace = "http://www.bsb.com/incubator/esb")
> public interface IWS {
> 	String GetPerson(@WebParam(name="socialId") String socialId) ;
> }
> 
> Using the debugger it seems that the exchange variable does not contains
> the request payload.
> Here is content:
> 
> Header: []
> Body: [[esb:GetPerson: null]]
> 
>  http://old.nabble.com/file/p28241790/%255BPAYLOAD%255DCxfPayload.png 
> 
> I provided the sample of my project.
> 
> 
> Olivier Roger wrote:
>> 
>> Thanks for you input willem,
>> 
>> I am using the lastest Fuse ESB distribution which includes Camel 2.2.
>> I will try to launch the example you indicated and what is different from
>> my implementation.
>> 
>> If I cannot figure it out I will provide a sample project.
>> 
>>  http://old.nabble.com/file/p28241790/CXFPayload.zip CXFPayload.zip 
>> 
>> Olivier
>> 
>> 
>> willem.jiang wrote:
>>> 
>>> I just ran a simple test by printing out the result of 
>>> exchange.getIn().getBody(String.class) in the 
>>> CxfConsumerPayloadTest.java on the trunk (Camel 2.3-SNAPSHOT), I can see 
>>> the message body was printed out rightly.
>>> 
>>> Which version of Camel are you using ?
>>> 
>>> Willem
>>> 
>>> Willem Jiang wrote:
>>>> Hi,
>>>> 
>>>> When you use exchange.getIn().getBody(String.class) to get the message,
>>>> camel will try to find a right converter to turn PayLoad (the actual 
>>>> object stored in the message body) into String.
>>>> It looks like there is not a converter to do this job, so you got null.
>>>> If I remember right, a StringConverter should be use in this case, I 
>>>> don't know why it doesn't work for you.
>>>> If you use exchange.getIn().getBody() , you should get the PayLoad 
>>>> object. You can find more detail example here[1]
>>>> 
>>>> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java 
>>>> 
>>>> 
>>>> Willem
>>>> 
>>>> Olivier Roger wrote:
>>>>> Hello Camel,
>>>>>
>>>>> I am experimenting a strange issue when using CXF inbound endpoint
>>>>> with
>>>>> PAYLOAD dataformat option (no problem in MESSAGE mode).
>>>>>
>>>>> First I declare a CXF endpoint:
>>>>>
>>>>>     <cxf:cxfEndpoint id="F1" address="http://localhost:10101/F1"
>>>>> serviceClass="CXFUseCase"> <!-- Interface with one method -->
>>>>>         <cxf:dataBinding>
>>>>>             <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"
>>>>> />
>>>>>         </cxf:dataBinding>
>>>>>         <cxf:properties>
>>>>>             <entry key="dataFormat" value="PAYLOAD"/>
>>>>>         </cxf:properties>
>>>>>     </cxf:cxfEndpoint>
>>>>>
>>>>> Then, in my route I use it:
>>>>>
>>>>>         <route>
>>>>>             <from uri="cxf:bean:F1" />
>>>>>             <bean ref="inspect" />
>>>>>
>>>>> When I debug in the inspect bean the Exchange object does not contain
>>>>> any
>>>>> value.
>>>>> However, setting a response value works correctly.
>>>>>
>>>>>     public void process(final Exchange exchange){
>>>>>         String msg = exchange.getIn().getBody(String.class);
>>>>>         System.out.println(msg); // is null
>>>>>         exchange.getOut().setBody(createResponse(), 
>>>>> PersonDocument.class); //
>>>>> is ok
>>>>>     }
>>>>>
>>>>> I read the documentation on the website but found it quite not clear. 
>>>>> Am I
>>>>> doing something wrong?
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Olivier
>>>> 
>>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/-CXF--Inbound-endpoint-with-PAYLOAD-dataformat-tp28240799p28241806.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: [CXF] Inbound endpoint with PAYLOAD dataformat

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

You can add a customer converter[1] to turn the Payload Object to be 
String, then you don't need change your other application code.

camel-cxf also has a converter[2] you can take it as an example.

[1]http://camel.apache.org/type-converter.html
[2]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java

Willem

Olivier Roger wrote:
> It seems that the code has changed since Camel 2.2.0:
> https://svn.apache.org/repos/asf/camel/tags/camel-2.2.0/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
> 
> I used the XMLConverter and it finds the value like this
> 
> new org.apache.camel.converter.jaxp.XmlConverter().toString(body.get(0))
> 
> <esb:GetPerson xmlns:esb="http://www.bsb.com/incubator/esb">
>          <socialId>528404-885-24</socialId>
> </esb:GetPerson>
> 
> Do I need to use a bean to extract the value in the Inbound endpoint then or
> is there a simpler way ?
> I cannot upgrade to Camel 2.3 since we are bound to the Fuse ESB release
> cycle.
> 
> 
> willem.jiang wrote:
>> It's right. If you take a look at the PayLoad[1] toString method, you 
>> will find it has header and body two parts. The content is right.
>> And [esb:GetPerson: null]] is the GetPerson element to String's value.
>>
>> [1] 
>> https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
>>
>> Willem
>>
>>
>> Olivier Roger wrote:
>>> I remove the xmlbeans usage to use an interface using String as input and
>>> output parameter types.
>>>
>>> package com.bsb.incubator.esb.fuse4;
>>>
>>> import javax.jws.WebParam;
>>> import javax.jws.WebService;
>>>
>>> @WebService(targetNamespace = "http://www.bsb.com/incubator/esb")
>>> public interface IWS {
>>> 	String GetPerson(@WebParam(name="socialId") String socialId) ;
>>> }
>>>
>>> Using the debugger it seems that the exchange variable does not contains
>>> the
>>> request payload.
>>> Here is content:
>>>
>>> Header: []
>>> Body: [[esb:GetPerson: null]]
>>>
>>> http://old.nabble.com/file/p28241790/%255BPAYLOAD%255DCxfPayload.png 
>>>
>>> I provided the sample of my project.
>>>
>>>
>>> Olivier Roger wrote:
>>>> Thanks for you input willem,
>>>>
>>>> I am using the lastest Fuse ESB distribution which includes Camel 2.2.
>>>> I will try to launch the example you indicated and what is different
>>>> from
>>>> my implementation.
>>>>
>>>> If I cannot figure it out I will provide a sample project.
>>>>
>>>>  http://old.nabble.com/file/p28241790/CXFPayload.zip CXFPayload.zip 
>>>>
>>>> Olivier
>>>>
>>>>
>>>> willem.jiang wrote:
>>>>> I just ran a simple test by printing out the result of 
>>>>> exchange.getIn().getBody(String.class) in the 
>>>>> CxfConsumerPayloadTest.java on the trunk (Camel 2.3-SNAPSHOT), I can
>>>>> see 
>>>>> the message body was printed out rightly.
>>>>>
>>>>> Which version of Camel are you using ?
>>>>>
>>>>> Willem
>>>>>
>>>>> Willem Jiang wrote:
>>>>>> Hi,
>>>>>>
>>>>>> When you use exchange.getIn().getBody(String.class) to get the
>>>>>> message,
>>>>>> camel will try to find a right converter to turn PayLoad (the actual 
>>>>>> object stored in the message body) into String.
>>>>>> It looks like there is not a converter to do this job, so you got
>>>>>> null.
>>>>>> If I remember right, a StringConverter should be use in this case, I 
>>>>>> don't know why it doesn't work for you.
>>>>>> If you use exchange.getIn().getBody() , you should get the PayLoad 
>>>>>> object. You can find more detail example here[1]
>>>>>>
>>>>>> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java 
>>>>>>
>>>>>>
>>>>>> Willem
>>>>>>
>>>>>> Olivier Roger wrote:
>>>>>>> Hello Camel,
>>>>>>>
>>>>>>> I am experimenting a strange issue when using CXF inbound endpoint
>>>>>>> with
>>>>>>> PAYLOAD dataformat option (no problem in MESSAGE mode).
>>>>>>>
>>>>>>> First I declare a CXF endpoint:
>>>>>>>
>>>>>>>     <cxf:cxfEndpoint id="F1" address="http://localhost:10101/F1"
>>>>>>> serviceClass="CXFUseCase"> <!-- Interface with one method -->
>>>>>>>         <cxf:dataBinding>
>>>>>>>             <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"
>>>>>>> />
>>>>>>>         </cxf:dataBinding>
>>>>>>>         <cxf:properties>
>>>>>>>             <entry key="dataFormat" value="PAYLOAD"/>
>>>>>>>         </cxf:properties>
>>>>>>>     </cxf:cxfEndpoint>
>>>>>>>
>>>>>>> Then, in my route I use it:
>>>>>>>
>>>>>>>         <route>
>>>>>>>             <from uri="cxf:bean:F1" />
>>>>>>>             <bean ref="inspect" />
>>>>>>>
>>>>>>> When I debug in the inspect bean the Exchange object does not contain
>>>>>>> any
>>>>>>> value.
>>>>>>> However, setting a response value works correctly.
>>>>>>>
>>>>>>>     public void process(final Exchange exchange){
>>>>>>>         String msg = exchange.getIn().getBody(String.class);
>>>>>>>         System.out.println(msg); // is null
>>>>>>>         exchange.getOut().setBody(createResponse(), 
>>>>>>> PersonDocument.class); //
>>>>>>> is ok
>>>>>>>     }
>>>>>>>
>>>>>>> I read the documentation on the website but found it quite not clear. 
>>>>>>> Am I
>>>>>>> doing something wrong?
>>>>>>>
>>>>>>> Thanks in advance,
>>>>>>>
>>>>>>> Olivier
>>>>>
>>
>>
> 


Re: [CXF] Inbound endpoint with PAYLOAD dataformat

Posted by Olivier Roger <ol...@bsb.com>.
It seems that the code has changed since Camel 2.2.0:
https://svn.apache.org/repos/asf/camel/tags/camel-2.2.0/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java

I used the XMLConverter and it finds the value like this

new org.apache.camel.converter.jaxp.XmlConverter().toString(body.get(0))

<esb:GetPerson xmlns:esb="http://www.bsb.com/incubator/esb">
         <socialId>528404-885-24</socialId>
</esb:GetPerson>

Do I need to use a bean to extract the value in the Inbound endpoint then or
is there a simpler way ?
I cannot upgrade to Camel 2.3 since we are bound to the Fuse ESB release
cycle.


willem.jiang wrote:
> 
> It's right. If you take a look at the PayLoad[1] toString method, you 
> will find it has header and body two parts. The content is right.
> And [esb:GetPerson: null]] is the GetPerson element to String's value.
> 
> [1] 
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
> 
> Willem
> 
> 
> Olivier Roger wrote:
>> I remove the xmlbeans usage to use an interface using String as input and
>> output parameter types.
>> 
>> package com.bsb.incubator.esb.fuse4;
>> 
>> import javax.jws.WebParam;
>> import javax.jws.WebService;
>> 
>> @WebService(targetNamespace = "http://www.bsb.com/incubator/esb")
>> public interface IWS {
>> 	String GetPerson(@WebParam(name="socialId") String socialId) ;
>> }
>> 
>> Using the debugger it seems that the exchange variable does not contains
>> the
>> request payload.
>> Here is content:
>> 
>> Header: []
>> Body: [[esb:GetPerson: null]]
>> 
>> http://old.nabble.com/file/p28241790/%255BPAYLOAD%255DCxfPayload.png 
>> 
>> I provided the sample of my project.
>> 
>> 
>> Olivier Roger wrote:
>>> Thanks for you input willem,
>>>
>>> I am using the lastest Fuse ESB distribution which includes Camel 2.2.
>>> I will try to launch the example you indicated and what is different
>>> from
>>> my implementation.
>>>
>>> If I cannot figure it out I will provide a sample project.
>>>
>>>  http://old.nabble.com/file/p28241790/CXFPayload.zip CXFPayload.zip 
>>>
>>> Olivier
>>>
>>>
>>> willem.jiang wrote:
>>>> I just ran a simple test by printing out the result of 
>>>> exchange.getIn().getBody(String.class) in the 
>>>> CxfConsumerPayloadTest.java on the trunk (Camel 2.3-SNAPSHOT), I can
>>>> see 
>>>> the message body was printed out rightly.
>>>>
>>>> Which version of Camel are you using ?
>>>>
>>>> Willem
>>>>
>>>> Willem Jiang wrote:
>>>>> Hi,
>>>>>
>>>>> When you use exchange.getIn().getBody(String.class) to get the
>>>>> message,
>>>>> camel will try to find a right converter to turn PayLoad (the actual 
>>>>> object stored in the message body) into String.
>>>>> It looks like there is not a converter to do this job, so you got
>>>>> null.
>>>>> If I remember right, a StringConverter should be use in this case, I 
>>>>> don't know why it doesn't work for you.
>>>>> If you use exchange.getIn().getBody() , you should get the PayLoad 
>>>>> object. You can find more detail example here[1]
>>>>>
>>>>> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java 
>>>>>
>>>>>
>>>>> Willem
>>>>>
>>>>> Olivier Roger wrote:
>>>>>> Hello Camel,
>>>>>>
>>>>>> I am experimenting a strange issue when using CXF inbound endpoint
>>>>>> with
>>>>>> PAYLOAD dataformat option (no problem in MESSAGE mode).
>>>>>>
>>>>>> First I declare a CXF endpoint:
>>>>>>
>>>>>>     <cxf:cxfEndpoint id="F1" address="http://localhost:10101/F1"
>>>>>> serviceClass="CXFUseCase"> <!-- Interface with one method -->
>>>>>>         <cxf:dataBinding>
>>>>>>             <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"
>>>>>> />
>>>>>>         </cxf:dataBinding>
>>>>>>         <cxf:properties>
>>>>>>             <entry key="dataFormat" value="PAYLOAD"/>
>>>>>>         </cxf:properties>
>>>>>>     </cxf:cxfEndpoint>
>>>>>>
>>>>>> Then, in my route I use it:
>>>>>>
>>>>>>         <route>
>>>>>>             <from uri="cxf:bean:F1" />
>>>>>>             <bean ref="inspect" />
>>>>>>
>>>>>> When I debug in the inspect bean the Exchange object does not contain
>>>>>> any
>>>>>> value.
>>>>>> However, setting a response value works correctly.
>>>>>>
>>>>>>     public void process(final Exchange exchange){
>>>>>>         String msg = exchange.getIn().getBody(String.class);
>>>>>>         System.out.println(msg); // is null
>>>>>>         exchange.getOut().setBody(createResponse(), 
>>>>>> PersonDocument.class); //
>>>>>> is ok
>>>>>>     }
>>>>>>
>>>>>> I read the documentation on the website but found it quite not clear. 
>>>>>> Am I
>>>>>> doing something wrong?
>>>>>>
>>>>>> Thanks in advance,
>>>>>>
>>>>>> Olivier
>>>>>
>>>>
>>>>
>>>
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/-CXF--Inbound-endpoint-with-PAYLOAD-dataformat-tp28240799p28242893.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: [CXF] Inbound endpoint with PAYLOAD dataformat

Posted by Willem Jiang <wi...@gmail.com>.
It's right. If you take a look at the PayLoad[1] toString method, you 
will find it has header and body two parts. The content is right.
And [esb:GetPerson: null]] is the GetPerson element to String's value.

[1] 
https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java

Willem


Olivier Roger wrote:
> I remove the xmlbeans usage to use an interface using String as input and
> output parameter types.
> 
> package com.bsb.incubator.esb.fuse4;
> 
> import javax.jws.WebParam;
> import javax.jws.WebService;
> 
> @WebService(targetNamespace = "http://www.bsb.com/incubator/esb")
> public interface IWS {
> 	String GetPerson(@WebParam(name="socialId") String socialId) ;
> }
> 
> Using the debugger it seems that the exchange variable does not contains the
> request payload.
> Here is content:
> 
> Header: []
> Body: [[esb:GetPerson: null]]
> 
> http://old.nabble.com/file/p28241790/%255BPAYLOAD%255DCxfPayload.png 
> 
> I provided the sample of my project.
> 
> 
> Olivier Roger wrote:
>> Thanks for you input willem,
>>
>> I am using the lastest Fuse ESB distribution which includes Camel 2.2.
>> I will try to launch the example you indicated and what is different from
>> my implementation.
>>
>> If I cannot figure it out I will provide a sample project.
>>
>>  http://old.nabble.com/file/p28241790/CXFPayload.zip CXFPayload.zip 
>>
>> Olivier
>>
>>
>> willem.jiang wrote:
>>> I just ran a simple test by printing out the result of 
>>> exchange.getIn().getBody(String.class) in the 
>>> CxfConsumerPayloadTest.java on the trunk (Camel 2.3-SNAPSHOT), I can see 
>>> the message body was printed out rightly.
>>>
>>> Which version of Camel are you using ?
>>>
>>> Willem
>>>
>>> Willem Jiang wrote:
>>>> Hi,
>>>>
>>>> When you use exchange.getIn().getBody(String.class) to get the message,
>>>> camel will try to find a right converter to turn PayLoad (the actual 
>>>> object stored in the message body) into String.
>>>> It looks like there is not a converter to do this job, so you got null.
>>>> If I remember right, a StringConverter should be use in this case, I 
>>>> don't know why it doesn't work for you.
>>>> If you use exchange.getIn().getBody() , you should get the PayLoad 
>>>> object. You can find more detail example here[1]
>>>>
>>>> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java 
>>>>
>>>>
>>>> Willem
>>>>
>>>> Olivier Roger wrote:
>>>>> Hello Camel,
>>>>>
>>>>> I am experimenting a strange issue when using CXF inbound endpoint with
>>>>> PAYLOAD dataformat option (no problem in MESSAGE mode).
>>>>>
>>>>> First I declare a CXF endpoint:
>>>>>
>>>>>     <cxf:cxfEndpoint id="F1" address="http://localhost:10101/F1"
>>>>> serviceClass="CXFUseCase"> <!-- Interface with one method -->
>>>>>         <cxf:dataBinding>
>>>>>             <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"
>>>>> />
>>>>>         </cxf:dataBinding>
>>>>>         <cxf:properties>
>>>>>             <entry key="dataFormat" value="PAYLOAD"/>
>>>>>         </cxf:properties>
>>>>>     </cxf:cxfEndpoint>
>>>>>
>>>>> Then, in my route I use it:
>>>>>
>>>>>         <route>
>>>>>             <from uri="cxf:bean:F1" />
>>>>>             <bean ref="inspect" />
>>>>>
>>>>> When I debug in the inspect bean the Exchange object does not contain
>>>>> any
>>>>> value.
>>>>> However, setting a response value works correctly.
>>>>>
>>>>>     public void process(final Exchange exchange){
>>>>>         String msg = exchange.getIn().getBody(String.class);
>>>>>         System.out.println(msg); // is null
>>>>>         exchange.getOut().setBody(createResponse(), 
>>>>> PersonDocument.class); //
>>>>> is ok
>>>>>     }
>>>>>
>>>>> I read the documentation on the website but found it quite not clear. 
>>>>> Am I
>>>>> doing something wrong?
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Olivier
>>>>
>>>
>>>
>>
> 


Re: [CXF] Inbound endpoint with PAYLOAD dataformat

Posted by Olivier Roger <ol...@bsb.com>.
I remove the xmlbeans usage to use an interface using String as input and
output parameter types.

package com.bsb.incubator.esb.fuse4;

import javax.jws.WebParam;
import javax.jws.WebService;

@WebService(targetNamespace = "http://www.bsb.com/incubator/esb")
public interface IWS {
	String GetPerson(@WebParam(name="socialId") String socialId) ;
}

Using the debugger it seems that the exchange variable does not contains the
request payload.
Here is content:

Header: []
Body: [[esb:GetPerson: null]]

http://old.nabble.com/file/p28241790/%255BPAYLOAD%255DCxfPayload.png 

I provided the sample of my project.


Olivier Roger wrote:
> 
> Thanks for you input willem,
> 
> I am using the lastest Fuse ESB distribution which includes Camel 2.2.
> I will try to launch the example you indicated and what is different from
> my implementation.
> 
> If I cannot figure it out I will provide a sample project.
> 
>  http://old.nabble.com/file/p28241790/CXFPayload.zip CXFPayload.zip 
> 
> Olivier
> 
> 
> willem.jiang wrote:
>> 
>> I just ran a simple test by printing out the result of 
>> exchange.getIn().getBody(String.class) in the 
>> CxfConsumerPayloadTest.java on the trunk (Camel 2.3-SNAPSHOT), I can see 
>> the message body was printed out rightly.
>> 
>> Which version of Camel are you using ?
>> 
>> Willem
>> 
>> Willem Jiang wrote:
>>> Hi,
>>> 
>>> When you use exchange.getIn().getBody(String.class) to get the message,
>>> camel will try to find a right converter to turn PayLoad (the actual 
>>> object stored in the message body) into String.
>>> It looks like there is not a converter to do this job, so you got null.
>>> If I remember right, a StringConverter should be use in this case, I 
>>> don't know why it doesn't work for you.
>>> If you use exchange.getIn().getBody() , you should get the PayLoad 
>>> object. You can find more detail example here[1]
>>> 
>>> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java 
>>> 
>>> 
>>> Willem
>>> 
>>> Olivier Roger wrote:
>>>> Hello Camel,
>>>>
>>>> I am experimenting a strange issue when using CXF inbound endpoint with
>>>> PAYLOAD dataformat option (no problem in MESSAGE mode).
>>>>
>>>> First I declare a CXF endpoint:
>>>>
>>>>     <cxf:cxfEndpoint id="F1" address="http://localhost:10101/F1"
>>>> serviceClass="CXFUseCase"> <!-- Interface with one method -->
>>>>         <cxf:dataBinding>
>>>>             <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"
>>>> />
>>>>         </cxf:dataBinding>
>>>>         <cxf:properties>
>>>>             <entry key="dataFormat" value="PAYLOAD"/>
>>>>         </cxf:properties>
>>>>     </cxf:cxfEndpoint>
>>>>
>>>> Then, in my route I use it:
>>>>
>>>>         <route>
>>>>             <from uri="cxf:bean:F1" />
>>>>             <bean ref="inspect" />
>>>>
>>>> When I debug in the inspect bean the Exchange object does not contain
>>>> any
>>>> value.
>>>> However, setting a response value works correctly.
>>>>
>>>>     public void process(final Exchange exchange){
>>>>         String msg = exchange.getIn().getBody(String.class);
>>>>         System.out.println(msg); // is null
>>>>         exchange.getOut().setBody(createResponse(), 
>>>> PersonDocument.class); //
>>>> is ok
>>>>     }
>>>>
>>>> I read the documentation on the website but found it quite not clear. 
>>>> Am I
>>>> doing something wrong?
>>>>
>>>> Thanks in advance,
>>>>
>>>> Olivier
>>> 
>>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/-CXF--Inbound-endpoint-with-PAYLOAD-dataformat-tp28240799p28241790.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: [CXF] Inbound endpoint with PAYLOAD dataformat

Posted by Olivier Roger <ol...@bsb.com>.
Thanks for you input willem,

I am using the lastest Fuse ESB distribution which includes Camel 2.2.
I will try to launch the example you indicated and what is different from my
implementation.

If I cannot figure it out I will provide a sample project.

Olivier


willem.jiang wrote:
> 
> I just ran a simple test by printing out the result of 
> exchange.getIn().getBody(String.class) in the 
> CxfConsumerPayloadTest.java on the trunk (Camel 2.3-SNAPSHOT), I can see 
> the message body was printed out rightly.
> 
> Which version of Camel are you using ?
> 
> Willem
> 
> Willem Jiang wrote:
>> Hi,
>> 
>> When you use exchange.getIn().getBody(String.class) to get the message,
>> camel will try to find a right converter to turn PayLoad (the actual 
>> object stored in the message body) into String.
>> It looks like there is not a converter to do this job, so you got null.
>> If I remember right, a StringConverter should be use in this case, I 
>> don't know why it doesn't work for you.
>> If you use exchange.getIn().getBody() , you should get the PayLoad 
>> object. You can find more detail example here[1]
>> 
>> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java 
>> 
>> 
>> Willem
>> 
>> Olivier Roger wrote:
>>> Hello Camel,
>>>
>>> I am experimenting a strange issue when using CXF inbound endpoint with
>>> PAYLOAD dataformat option (no problem in MESSAGE mode).
>>>
>>> First I declare a CXF endpoint:
>>>
>>>     <cxf:cxfEndpoint id="F1" address="http://localhost:10101/F1"
>>> serviceClass="CXFUseCase"> <!-- Interface with one method -->
>>>         <cxf:dataBinding>
>>>             <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding" />
>>>         </cxf:dataBinding>
>>>         <cxf:properties>
>>>             <entry key="dataFormat" value="PAYLOAD"/>
>>>         </cxf:properties>
>>>     </cxf:cxfEndpoint>
>>>
>>> Then, in my route I use it:
>>>
>>>         <route>
>>>             <from uri="cxf:bean:F1" />
>>>             <bean ref="inspect" />
>>>
>>> When I debug in the inspect bean the Exchange object does not contain
>>> any
>>> value.
>>> However, setting a response value works correctly.
>>>
>>>     public void process(final Exchange exchange){
>>>         String msg = exchange.getIn().getBody(String.class);
>>>         System.out.println(msg); // is null
>>>         exchange.getOut().setBody(createResponse(), 
>>> PersonDocument.class); //
>>> is ok
>>>     }
>>>
>>> I read the documentation on the website but found it quite not clear. 
>>> Am I
>>> doing something wrong?
>>>
>>> Thanks in advance,
>>>
>>> Olivier
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/-CXF--Inbound-endpoint-with-PAYLOAD-dataformat-tp28240799p28241427.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: [CXF] Inbound endpoint with PAYLOAD dataformat

Posted by Willem Jiang <wi...@gmail.com>.
I just ran a simple test by printing out the result of 
exchange.getIn().getBody(String.class) in the 
CxfConsumerPayloadTest.java on the trunk (Camel 2.3-SNAPSHOT), I can see 
the message body was printed out rightly.

Which version of Camel are you using ?

Willem

Willem Jiang wrote:
> Hi,
> 
> When you use exchange.getIn().getBody(String.class) to get the message,
> camel will try to find a right converter to turn PayLoad (the actual 
> object stored in the message body) into String.
> It looks like there is not a converter to do this job, so you got null.
> If I remember right, a StringConverter should be use in this case, I 
> don't know why it doesn't work for you.
> If you use exchange.getIn().getBody() , you should get the PayLoad 
> object. You can find more detail example here[1]
> 
> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java 
> 
> 
> Willem
> 
> Olivier Roger wrote:
>> Hello Camel,
>>
>> I am experimenting a strange issue when using CXF inbound endpoint with
>> PAYLOAD dataformat option (no problem in MESSAGE mode).
>>
>> First I declare a CXF endpoint:
>>
>>     <cxf:cxfEndpoint id="F1" address="http://localhost:10101/F1"
>> serviceClass="CXFUseCase"> <!-- Interface with one method -->
>>         <cxf:dataBinding>
>>             <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding" />
>>         </cxf:dataBinding>
>>         <cxf:properties>
>>             <entry key="dataFormat" value="PAYLOAD"/>
>>         </cxf:properties>
>>     </cxf:cxfEndpoint>
>>
>> Then, in my route I use it:
>>
>>         <route>
>>             <from uri="cxf:bean:F1" />
>>             <bean ref="inspect" />
>>
>> When I debug in the inspect bean the Exchange object does not contain any
>> value.
>> However, setting a response value works correctly.
>>
>>     public void process(final Exchange exchange){
>>         String msg = exchange.getIn().getBody(String.class);
>>         System.out.println(msg); // is null
>>         exchange.getOut().setBody(createResponse(), 
>> PersonDocument.class); //
>> is ok
>>     }
>>
>> I read the documentation on the website but found it quite not clear. 
>> Am I
>> doing something wrong?
>>
>> Thanks in advance,
>>
>> Olivier
> 
> 


Re: [CXF] Inbound endpoint with PAYLOAD dataformat

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

When you use exchange.getIn().getBody(String.class) to get the message,
camel will try to find a right converter to turn PayLoad (the actual 
object stored in the message body) into String.
It looks like there is not a converter to do this job, so you got null.
If I remember right, a StringConverter should be use in this case, I 
don't know why it doesn't work for you.
If you use exchange.getIn().getBody() , you should get the PayLoad 
object. You can find more detail example here[1]

[1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java

Willem

Olivier Roger wrote:
> Hello Camel,
> 
> I am experimenting a strange issue when using CXF inbound endpoint with
> PAYLOAD dataformat option (no problem in MESSAGE mode).
> 
> First I declare a CXF endpoint:
> 
> 	<cxf:cxfEndpoint id="F1" address="http://localhost:10101/F1"
> serviceClass="CXFUseCase"> <!-- Interface with one method -->
> 		<cxf:dataBinding>
> 			<bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding" />
> 		</cxf:dataBinding>
> 		<cxf:properties>
> 			<entry key="dataFormat" value="PAYLOAD"/>
> 		</cxf:properties>
> 	</cxf:cxfEndpoint>
> 
> Then, in my route I use it:
> 
> 		<route>
> 			<from uri="cxf:bean:F1" />
> 			<bean ref="inspect" />
> 
> When I debug in the inspect bean the Exchange object does not contain any
> value.
> However, setting a response value works correctly.
> 
>     public void process(final Exchange exchange){
>     	String msg = exchange.getIn().getBody(String.class);
>     	System.out.println(msg); // is null
>     	exchange.getOut().setBody(createResponse(), PersonDocument.class); //
> is ok
>     }
> 
> I read the documentation on the website but found it quite not clear. Am I
> doing something wrong?
> 
> Thanks in advance,
> 
> Olivier