6

I'm using jboss fuse 6.1-final:

here is my simple route:

<route>
    <from uri="cxf:bean:synchronousEndpoint"/>
    <log message="Service invoked." />
    <process ref="simpleProcessor"/>
</route>

and in the simpleProcessor I'm putting correct response(i.e corresponding JAXB object) to the context. But, it responds with fault:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
       <soap:Fault>
           <faultcode>soap:Server</faultcode>
           <faultstring>Marshalling Error: java.lang.Object cannot be cast to org.w3c.dom.Element</faultstring>
       </soap:Fault>
   </soap:Body>
</soap:Envelope>

here is stack trace:

Caused by: java.lang.ClassCastException: java.lang.Object cannot be cast to org.w3c.dom.Element

is there any hints or suggestions?

Nurlan
  • 673
  • 4
  • 18

1 Answers1

0

Bit hard to say without seeing some more code from the simpleProcessor. However it seems like you are using the wrong dataFormat parameter.

The cxf component has a dataFormat parameter which can be any of the following:

  • POJO: POJOs (Plain old Java objects) are the Java parameters to the method being invoked on the target server. Both Protocol and Logical JAX-WS handlers are supported.

  • PAYLOAD: PAYLOAD is the message payload (the contents of the soap:body) after message configuration in the CXF endpoint is applied. Only Protocol JAX-WS handler is supported. Logical JAX-WS handler is not supported.

  • MESSAGE: MESSAGE is the raw message that is received from the transport layer. It is not suppose to touch or change Stream, some of the CXF interceptors will be removed if you are using this kind of DataFormat so you can't see any soap headers after the camel-cxf consumer and JAX-WS handler is not supported.

  • CXF_MESSAGE: New in Camel 2.8.2, CXF_MESSAGE allows for invoking the full capabilities of CXF interceptors by converting the message from the transport layer into a raw SOAP message

The default is POJO which means there is no XML being passed as a message Camel is passing objects. I suspect you might be trying to manipulate the response as XML and this is causing problems.

I ran into something similiar to this a while back where I was trying to convert the POJO into XML by trying to do a XPATH query on the XML when I was receiving a POJO.

Namphibian
  • 12,046
  • 7
  • 46
  • 76