Hi Scott,

I just create a simple test to reproduce the error and found you need to specify a right operation in you cxf endpoint to make sure the elements of the PayLoad Message can be set rightly into the CXF request message.

So I create a JIRA[1] and commit a quick fix[2] for it.
[1]https://issues.apache.org/jira/browse/CAMEL-3761
[2]http://svn.apache.org/viewvc?rev=1078684&view=rev


Willem

On 3/5/11 9:41 AM, Scott Came wrote:
Per Willem's advice [1] I have attempted to bring in the CxfPayloadConverter 
from 2.7-SNAPSHOT [2] so that I can make the following Camel route work:

<osgi:camelContext xmlns="http://camel.apache.org/schema/spring";>
     <route>
       <from uri="file:/tmp/tsc-input"/>
       <to uri="cxf:bean:outEndpoint?dataFormat=PAYLOAD"/>
     </route>
   </osgi:camelContext>

I am able to build and deploy the converter just fine within my osgi bundle.  
However, I've run into a problem whereby the body on the converted message is empty.  
I know this because I am routing the outbound message through tcpmon, and it just has 
a<soap:Body/>  element where the body should be:

Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://it.ojp.gov/GlobalJRA/TSCEI/0.9.4/ws/SendEncounter";
Accept: */*
User-Agent: Apache CXF 2.3.2-fuse-00-00
Cache-Control: no-cache
Pragma: no-cache
Host: 127.0.0.1:18081
Connection: keep-alive
Content-Length: 98

<soap:Envelope 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><soap:Body/></soap:Envelope>

To try to identify the problem, I have reduced the converter down to a single 
method (see attached, method genericFileToCxfPayload(...)).  The code is 
running, and when I set the log level to debug, I see the full body in the 
debug messages.  So I am confident the payload object being returned has a 
proper body...it's just getting lost somewhere before the message hits the 
wire.  How could that happen?

Oddly enough, I discovered that not only was the GenericFile ->  CxfPayload converter 
called, but it is also wanting to convert from CxfPayload ->  String.  I can't 
imagine why this is the case.  I do have another OSGi bundle, with a camel route, 
deployed in this same instance of servicemix, and that bundle's route does go from 
CxfPayload ->  String.  But it is in a separate bundle, so my assumption would be 
that the type converter class would not be accessible.  Is that assumption incorrect?  
In any case, the debug message in the CxfPayloadToString method in the attached does get 
called, and the payload.getBody() call there returns null.

Thanks for any advice.
--Scott

[1] http://www.mail-archive.com/users@camel.apache.org/msg13115.html
[2] 
https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Reply via email to