Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] XPath in a Route not working

Hello,
I'm developing a route in Talend Studio (we have Talend 5.1.2). I'm having several problems
The most blocking is about extracting a data from our incoming XML with an XPath query (in a cSetHeader component). I got the following exception
cLog_2 INFO Exchange]
:1:1: Premature end of file.
DefaultErrorHandler ERROR Failed delivery for (MessageId: ID-HL-27-59661-1383840349964-0-2 on ExchangeId: ID-HL-27-59661-1383840349964-0-1). Exhausted after delivery attempt: 1 caught: org.apache.camel.TypeConversionException: Error during type conversion from type: org.apache.camel.converter.stream.InputStreamCache to the required type: org.w3c.dom.Document with value org.apache.camel.converter.stream.InputStreamCache@7a0280ad due org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
org.apache.camel.TypeConversionException: Error during type conversion from type: org.apache.camel.converter.stream.InputStreamCache to the required type: org.w3c.dom.Document with value org.apache.camel.converter.stream.InputStreamCache@7a0280ad due org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:117)
at org.apache.camel.builder.xml.XPathBuilder.doGetDocument(XPathBuilder.java:961)
at org.apache.camel.builder.xml.XPathBuilder.getDocument(XPathBuilder.java:940)
at org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:785)
at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:692)
at org.apache.camel.builder.xml.XPathBuilder.evaluate(XPathBuilder.java:662)
at org.apache.camel.builder.xml.XPathBuilder.evaluate(XPathBuilder.java:147)
In the attached screenshot I show this part of the route, as well as the configuration of the cSetHeader component
Any idea??
Regards,
Enrique

PS: Should I post here the other problems, or rather one problem per post?
0683p000009MBgL.png0683p000009MBgt.png0683p000009MBgy.png0683p000009MBNW.png
Labels (5)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

3 Replies
Anonymous
Not applicable
Author

Hi Enrique,
Try adding a cConvertBody before the cSetHeader. Just use its default conversion target (String). This should prepare the body to be read by the XPath processor.
Best Regards,
-Ben
Anonymous
Not applicable
Author

Hi Ben,
Thank you for your response. I found that the XPath was also failing because the ftp component modifies the body in. So I added a wiretap component with the settings attached in the 3rd screenshot.
The XPath seems to work, but I can't use it in my cHTTP. I want to use this header as a param for my GET request (see 4th screenshot in my first post), but I get this request:
GET /hlEndpoint/getStatus?orderNum=%24%7Bheader.newOrderId%7D HTTP/1.1

Any idea how to resolve this header variable?
Best regards,
Enrique
Anonymous
Not applicable
Author

Hello,
I've created a new topic for the last problem:
https://community.talend.com/t5/Design-and-Development/resolved-Reference-header-element-in-cHTTP-in...
Best,
Enrique