Hello,

in my integration prototype an existing web-service should be adapted to 
an other contract. Therefore, I have a cxf:consumer(dataFormat=PAYLOAD; 
the associated cxf:endpoint definition references a WSDL but no service 
class) and a cxf:producer (the associated cxf:endpoint references a 
service class that has been generated from a WSDL). In this scenario, I?m 
getting an exception, when the response is send back within the 
cxf:consumer (XMLStreamDataWriter.write expects DataSource, Node or 
Source) . 
After doing some debugging, binding.populateCxfResponseFromExchange 
extracts the data format from the current exchange (in my case 
cxf:producer with data format POJO) and not the current endpoint (in my 
case cxf:consumer with data format PAYLOAD). 

What's the correct interaction between those components? The mix of data 
formats is needed, because
1.) the SOAP headers should be inspected
2.) the incoming SOAP message can contain invalid type representation 
(e.g. timestamp) that have to be corrected before => POJO can not be used 
in this case

code from org.apache.camel.component.cxf.CxfConsumer

@SuppressWarnings("unchecked")
private void setResponseBack(Exchange cxfExchange, 
org.apache.camel.Exchange camelExchange) {
    CxfEndpoint endpoint = (CxfEndpoint)getEndpoint();
    CxfBinding binding = endpoint.getCxfBinding(); 
 
    checkFailure(camelExchange);
 
    // bind the Camel response into a CXF response
    if (camelExchange.getPattern().isOutCapable()) {
        binding.populateCxfResponseFromExchange(camelExchange, 
cxfExchange);
    }
 
    // check failure again as fault could be discovered by converter
    checkFailure(camelExchange);

    // copy the headers javax.xml.ws header back
    binding.copyJaxWsContext(cxfExchange, (Map<String, 
Object>)camelExchange.getProperty(CxfConstants.JAXWS_CONTEXT));
}

I?m using camel-cxf 2.5.0

Thanks,
Thomas



Der Austausch von Nachrichten mit o.a. Absender via e-mail dient ausschließlich 
Informationszwecken. Rechtsgeschäftliche Erklärungen dürfen über dieses Medium 
nicht ausgetauscht werden.

Correspondence with a.m. sender via e-mail is only for information purposes. 
This medium is not to be used for the exchange of legally-binding 
communications.

Reply via email to