We are implementing a generic dynamic view generation layer that can render the output using XSLT. We extract the SOAP body from the soap response, apply XSLT to generate template based html output.
The same implementation works fine using a simple JSP/Servlet implementation.
But when we implement the same logic within seam, we get an exception
"
2010-09-28 00:18:27,709 ERROR [STDERR] (http-0.0.0.0-8080-4) [Fatal Error] :-1:-1: Premature end of file.
2010-09-28 00:18:27,711 ERROR [STDERR] (http-0.0.0.0-8080-4) javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: Premature end of file.
2010-09-28 00:18:27,712 ERROR [STDERR] (http-0.0.0.0-8080-4) at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:936)
2010-09-28 00:18:27,712 ERROR [STDERR] (http-0.0.0.0-8080-4) at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:774)
"
Code snippet
private String processXML() throws IOException {
StringWriter out = new StringWriter();
if(this.xmlinputString != null && this.xsltemplate != null)
try {
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(
new StringReader(getXsltemplate())));
transformer.transform(new StreamSource(new StringReader(
getXmlinputString())), new StreamResult(out));
} catch(Exception e) {
e.printStackTrace();
throw new IOException(e);
}
System.out.println(out.toString());
return (out.toString());
}