Hi,
I'm using Spring-WS 1.5.4 to run a MTOM web service using an axiomSoapMessageFactory (1.2.8). The Web service I am writting takes a XML file as an attachment. JaxB2 provides that attachment as a Javax.xml.transform.Source object. I am trying to copy the source into a file on the system using the following method:
whenever I do this I get the following error:Code:final Source source = request.getSource(); StreamSource streamSource = (StreamSource) source; TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); File file = new File ("/tempxmlfile.xml"); try{ transformer.transform(streamSource, new StreamResult(file)); LOG.info("File saved in "+file.getAbsolutePath()); }
I've discovered that the problem is with the fact that the Source object, when cast as a StreamSource, has no inputStream only a Reader Object and that Reader has not properly dealt with the fact that the XML file it is reading has a UFT-8 Byte Order Mark (BOM) in the file to identify it's encoding. I know this because if I provide a UFT-8 file with no BOM the web service works fine.Code:Fatal Error :1:1: Content is not allowed in prolog. ERROR: 'Content is not allowed in prolog.'
Is this a known issue, if so has it been fixed?
If not is it an issue with Spring-WS or something which needs to be fixed in JAXB2?
Regards,
Craig


Reply With Quote
