Hi Aki.  Yes, I've verified that the structure is exactly what's expected.  
I've validated the XML file (that starts the route) against the schemas 
referenced by the WSDL.

It certainly seems like one of the built-in interceptors is taking the body 
content out of the CxfPayload before it is written to http.  I dump the 
contents of the CxfPayload body right at the end of my type conversion method 
so I know it is complete and proper at that point.  Then I see in the log (at 
DEBUG level) where the HttpURLConnection reports a Content-Length header that 
is way too short for the amount of content that should be in the body.  So it 
must be somewhere between those two points where the body is mysteriously 
disappearing.

I note that the interceptors are not writing out TRACE log messages or anything 
really that gives insight into which one of them may have the problem.  I would 
think that if an interceptor were going to remove the body content, that would 
be something that would be logged, at least at the WARN level.

My expectation would be that in PAYLOAD mode, CXF would just pass along 
whatever XML is set as the body on the CxfPayload, rather than mucking around 
with it.  Is that not the right expectation?

Thanks.
--Scott

-----Original Message-----
From: Aki Yoshida [mailto:elak...@googlemail.com] 
Sent: Saturday, March 05, 2011 8:09 AM
To: users@camel.apache.org
Subject: Re: Generic file -> CXF Payload type converter issues

Hi Scott,
Have you checked if your payload XML matches the XML structure defined by your 
cxf bean endpoint? I noticed the same problem sometime ago and thought that 
this was happening when I had a wrong XML payload document. I was using SAAJ to 
extract the SOAP body child at one of my interceptors and finding no body 
child, even though the message had some content.  Using the correct payload, 
the problem did not occur.
So, I am curious whether you have the same situation or another case.

I wanted to look into this problem and to make the CXF runtime to raise an 
exception instead of processing further without the soap body. But I haven't 
had time.

Regards, Aki

2011/3/5 Scott Came <scott.c...@search.org>:
> 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/></s
> oap: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
>
>


Reply via email to