You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Varsha167 <va...@target.com> on 2016/06/27 05:14:39 UTC

Premature End Of File Error in XML

I am trying to parse an XML file through a Camel Code. This is a portion of
my Camel Code where I am parsing the XML :

                 .to("http://abc.apt.com")
                .log("Response received - ${body}")
                .log(LoggingLevel.INFO, "UPCI Fetched")
                .convertBodyTo(String.class)
             *   .to("xslt:xslt/FPFormatting.xsl")*
                //.marshal(xmlJsonFormat)
                .log(LoggingLevel.INFO, "response received ${body}")
                .end();

The above code gives me an error :
*
2016-06-24 17:27:26 WARN  o.a.c.component.seda.SedaConsumer - Error
processing exchange. Exchange[][Message: ]. Caused by:
[javax.xml.transform.TransformerException - ParseError at [row,col]:[1,1]
Message: Premature end of file.]
javax.xml.transform.TransformerException: ParseError at [row,col]:[1,1]
Message: Premature end of file.*

When executed individually, the XSLT (FPFormatting.xsl )is producing correct
XML results. Only when I execute the code, it gives me the above error. 

I tried adding Saxon dependency in Gradle, tried converting the body to
string, but this is not working. 




--
View this message in context: http://camel.465427.n5.nabble.com/Premature-End-Of-File-Error-in-XML-tp5784421.html
Sent from the Camel Development mailing list archive at Nabble.com.

RE: Premature End Of File Error in XML

Posted by "Siano, Stephan" <st...@sap.com>.
Hi,

I guess your log statement reads the body. If the body returned by your http endpoint is a stream and you do not have stream caching enabled on your route the stream will be read and the body will be empty afterwards. The XML parser used to process your XSLT mapping will then get an empty document, which will result in this premature EOF error...

So either remove your log statement (or move it after the conversion to string) or enable stream caching on your route. That should help.

Best regards
Stephan

-----Original Message-----
From: Varsha167 [mailto:varsha.tiwari@target.com] 
Sent: Montag, 27. Juni 2016 07:15
To: dev@camel.apache.org
Subject: Premature End Of File Error in XML

I am trying to parse an XML file through a Camel Code. This is a portion of
my Camel Code where I am parsing the XML :

                 .to("http://abc.apt.com")
                .log("Response received - ${body}")
                .log(LoggingLevel.INFO, "UPCI Fetched")
                .convertBodyTo(String.class)
             *   .to("xslt:xslt/FPFormatting.xsl")*
                //.marshal(xmlJsonFormat)
                .log(LoggingLevel.INFO, "response received ${body}")
                .end();

The above code gives me an error :
*
2016-06-24 17:27:26 WARN  o.a.c.component.seda.SedaConsumer - Error
processing exchange. Exchange[][Message: ]. Caused by:
[javax.xml.transform.TransformerException - ParseError at [row,col]:[1,1]
Message: Premature end of file.]
javax.xml.transform.TransformerException: ParseError at [row,col]:[1,1]
Message: Premature end of file.*

When executed individually, the XSLT (FPFormatting.xsl )is producing correct
XML results. Only when I execute the code, it gives me the above error. 

I tried adding Saxon dependency in Gradle, tried converting the body to
string, but this is not working. 




--
View this message in context: http://camel.465427.n5.nabble.com/Premature-End-Of-File-Error-in-XML-tp5784421.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Premature End Of File Error in XML

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See this FAQ
http://camel.apache.org/why-is-my-message-body-empty.html

And next time use the @user mailing list / user forum - not dev.


On Mon, Jun 27, 2016 at 7:14 AM, Varsha167 <va...@target.com> wrote:
> I am trying to parse an XML file through a Camel Code. This is a portion of
> my Camel Code where I am parsing the XML :
>
>                  .to("http://abc.apt.com")
>                 .log("Response received - ${body}")
>                 .log(LoggingLevel.INFO, "UPCI Fetched")
>                 .convertBodyTo(String.class)
>              *   .to("xslt:xslt/FPFormatting.xsl")*
>                 //.marshal(xmlJsonFormat)
>                 .log(LoggingLevel.INFO, "response received ${body}")
>                 .end();
>
> The above code gives me an error :
> *
> 2016-06-24 17:27:26 WARN  o.a.c.component.seda.SedaConsumer - Error
> processing exchange. Exchange[][Message: ]. Caused by:
> [javax.xml.transform.TransformerException - ParseError at [row,col]:[1,1]
> Message: Premature end of file.]
> javax.xml.transform.TransformerException: ParseError at [row,col]:[1,1]
> Message: Premature end of file.*
>
> When executed individually, the XSLT (FPFormatting.xsl )is producing correct
> XML results. Only when I execute the code, it gives me the above error.
>
> I tried adding Saxon dependency in Gradle, tried converting the body to
> string, but this is not working.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Premature-End-Of-File-Error-in-XML-tp5784421.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2