Seven Stars

get CXF response from DSL processor - works in Talend, not in Karaf

Hi

In Talend ESB 6.4.1, for dynamic purposes we use a DSLProcessor component to build a client CXF endpoint on the fly :

 

.toD("cxf://..."
 + "dataFormat=PAYLOAD"
 + "&wsdlURL=..."
 + "&serviceName=..."
 + "&endpointName=..."
 + "&username=..."
 + "&password=..."
 + "&headerFilterStrategy=#CXF_PAYLOAD_HEADER_FILTER"    
)

The call to the webservice itself works fine.

 

In the next component we try to get the WS soap response :

 

String response = exchange.getIn().getBody(String.class)

works fine when ran in Talend console (we can see the response code), but conversion of exchange body to String class fails with this error in Karaf :

 javax.xml.transform.TransformerException: Can't transform a Source of type javax.xml.transform.stax.StAXSource

We tried many workarounds:

 

- insert a cConvertBodyTo --> String.class

- manage the response format with org.apache.camel.component.cxf.CxfPayload library then write it into a StringWriter --> same error

- manager the response format with javax.xml.transform.stax.StAXSource library, but the exchange body cannot be casted to this (very strange, given the error above)

 

We need a solution to get the response.

Thanks

Loko

 

3 REPLIES
Moderator

Re: get CXF response from DSL processor - works in Talend, not in Karaf

Hello,

We have redirected your issue to our ESB experts and then come back to you as soon as we can.

Many thanks for your time.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Employee

Re: get CXF response from DSL processor - works in Talend, not in Karaf

Hi Loko,

 

You may try to resolve this issue following

Option 1), adding the "&allowStreaming=true" to your DSL CXF endpoint, I don't remember exactly the default value is true or false in Camel cxf component, but you can swith true/false to testing

Option 2), set back the String to the body after you getBody(String.class), like this: exchange.getIn().setBody(response);

 

Let us see if it will woks. (it works in Studio run maybe the Studio has not camel-cache dependency added by default)

 

Xilai

Seven Stars

Re: get CXF response from DSL processor - works in Talend, not in Karaf

Hi Xilai

Didn't mentionned it in my first post, but unfortunatly we already tried true and false for streaming parameter, none works.

 

About 2nd option, it is not possible as we run into an exception from "getBody(String.class)".

 

Loko