Problems tRestClient component not reading XML response body type

Four Stars

Problems tRestClient component not reading XML response body type

I've got major headache with getting these components to work with xml body content type.
What is more mystifying is that that all my jobs were working fine locally and on TAC server, then a few days ago they stopped working and I got the following errors, while we have other jobs, that use the same tRESTClient components, running on TAC server just fine, 
We've tried creating in commercial version of studio (where the working jobs were created), and imported them into "Platform" version (where I created the failing jobs) to remotely upload to TAC server. But I get same error what ever version I export these jobs too.
I get following errors with tRESTClient , Log Messages "On"
----------------------------
ID: 1
Response-Code: 200
Encoding: ISO-8859-1
Content-Type: text/xml; schema=authentication-result
Headers: {Cache-Control=, Content-Length=, content-type=, Date=, Server=, Set-Cookie=, Warning=, X-AspNet-Version=, X-Powered-By=}
Payload: <Result><Success>true</Success><Token>9CBC391C056EBE00B5CB499906121B1023361D03A159C2E4B90773B63C699DD68925AD8B30E5746E605C89F2E777FA9A85019E9B3B7CEDACB79AC61F6433F88A31B5ABD43642D8B1662FBBCDFAB02378135A3ECBE15E2D6AA9DCB246E71449F80B1FA5E985207973765FC41CCB407F9A5D4C645C</Token></Result>
--------------------------------------
: org.apache.cxf.jaxrs.client.AbstractClient - .Problem with reading the response message, class : interface org.dom4j.Document, ContentType : text/xml;schema=authentication-result.
Exception in component tRESTClient_2
javax.ws.rs.client.ClientException: .Problem with reading the response message, class : interface org.dom4j.Document, ContentType : text/xml;schema=authentication-result.
I can make it work by changing the "Accept Type" to "Any" then the xml gets returned as a string , and use textractregexfields to get the token.
However I need to pass an xml payload to my second tRestClient and this now fails??
Employee

Re: Problems tRestClient component not reading XML response body type

can you use tConvertType to convert String to Document schema type?
Thomas
Thomas Steinborn
VP Product Management
Employee

Re: Problems tRestClient component not reading XML response body type

Hi
Has something changed in the studio setup/version by the time the job stopped working ? If nothing has changed but the working job has stopped working then may the response data have changed ? The log statement shows some unrecognized symbols just before a Result tag, what do those symbols represent ?
Sergey
Four Stars

Re: Problems tRestClient component not reading XML response body type

It appears to be a BOM ("Byte Order mark"), I'm told that the response from the REST services we're using is UTF-8, but that the response output provided by the tRESTClient is ISO-8859-1.
Can you confirm what encoding the tRESTClient uses by default?
How do I set this in Talend?
I've tried using "Accept-Charset : utf-8" header, but this gives me an "java.io.IOException: Illegal character: <>" error, when I do xml body posts to the REST service.
Regards,
Synfield
Employee

Re: Problems tRestClient component not reading XML response body type

Looking back at this issue, is there any chance you can provide a test job helping to reproduce the issue ? Thanks