KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to create a soap message with the following structure: <SOAP:Envelope> <SOAP:Header/> <SOAP:Body> <Item1/> <Item2/> </SOAP:Body> </SOAP:Envelope> I am using a WebServiceMessageCallback to get the above format, but when I try and transform the body with the new source, where source has the above format: TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.transform(source, soapBody.getPayloadResult()); I get the following error: [Fatal Error] :1:157: The markup in the document following the root element must be well-formed. ERROR: 'The markup in the document following the root element must be well-formed.' Exception in thread "main" org.springframework.ws.client.WebServiceTransformerException:Transformation error: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 157; The markup in the document following the root element must be well-formed.; nested exception is javax.xml.transform.TransformerException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 157; The markup in the document following the root element must be well-formed. My understanding is that this error is telling me that the body is not well-formed XML because it doesn't have a single root element. However, that is what I need as the service I am sending the message to expects the above structure. Is there some way around this? Thanks for any help. EDIT: I should mention that I have seen Spring Update SOAP Header with Two Elements , which is what I am trying to do but in the header instead. I have tried his method of using a dummy root, but I am not sure how to remo
Tags (comma-separated)
Save Edits
Cancel