Hi,

I just tried the solution of the JAXWS Handler, it only print out the soap message and doesn't change the output stream which is sent to client.

After digging a while, I found the StaxOutInterceptor[1] will check the message context with the key of "org.apache.cxf.stax.force-start-document" to decide if it will send the xml declaration.

So you can configure this interceptor[2] into the camel-cxf endponit or setting the message header when you return the response to the cxf client.

BTW, the last option only work in Camel 2.4 SNAPSHOT [3].

[1]http://www.docjar.com/html/api/org/apache/cxf/interceptor/StaxOutInterceptor.java.html
[2]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/WriteXmlDeclarationInterceptor.java
[3]https://issues.apache.org/activemq/browse/CAMEL-2841

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang


William Tam wrote:
There is a way of adding the XML header by using JAXWS handler. http://stackoverflow.com/questions/1614431/webservicice-with-apache-cxf-and-custom-headers

But, let me see if there is a easier way to it without requiring handler.

On 06/21/2010 11:50 AM, S. Ali Tokmen wrote:
Hello

I have routes that use CAMEL-CXF. When I call these routes via SoapUI, JAX-WS, JAX-RPC or even Microsoft C# these work perfectly.

BUT, when I try with PHP (whether NuSOAP or the new SoapClient), I have a PHP error like:

   Error:sendSms: SoapFault exception: [Client] looks like we got no
   XML document in [...]

If I look at the HTTP response generated by CAMEL-CXF, its response looks like:

   HTTP/1.1 200 OK
   Server: Apache-Coyote/1.1
   Content-Type: multipart/related; type="application/xop+xml";
   boundary="uuid:7de96b4c-37f3-4835-9519-7adad8ce8114";
   start="<[email protected]>"; start-info="text/xml"
   Content-Length: 1235
   Date: Mon, 21 Jun 2010 15:32:15 GMT


   --uuid:7de96b4c-37f3-4835-9519-7adad8ce8114
   Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
   Content-Transfer-Encoding: binary
   Content-ID: <[email protected]>

<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><soap:Body>[...]</soap:Body></soap:Envelope>
   --uuid:7de96b4c-37f3-4835-9519-7adad8ce8114--

As a result, the SOAP content doesn't start with:

<?xml version="1.0" encoding="utf-8"?>

... and I think that's what making PHP fail.

Any ideas on putting the XML header in front of the SOAP response?

Cheers



Reply via email to