Incomplete document transformation into SOAP body
-------------------------------------------------
Key: AXIS2-4951
URL: https://issues.apache.org/jira/browse/AXIS2-4951
Project: Axis2
Issue Type: Bug
Components: saaj
Affects Versions: 1.5.4
Environment: Java 6
Reporter: Lukas Krecan
When performing transformation into SOAPMessage.getSOAPBody() the resulting
message ends in the middle.
To make it even more complicated, it happens only if axis2-jaxws:1.5.4 is on
the classpath.
private static final String INPUT = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><plus xmlns=\"http://javacrumbs.net/calc\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><a>1</a><b>2</b></plus>";
@Test
public void testTransform() throws Exception
{
MessageFactory messageFactory =
MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage message = messageFactory.createMessage();
Document source =
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new
ByteArrayInputStream(INPUT.getBytes()));
transform(new DOMSource(source), new
DOMResult(message.getSOAPBody()));
String output = serialize(new
DOMSource(message.getSOAPBody().getFirstChild()));
System.out.println(output);
assertEquals(INPUT, output);
}
public String serialize(Source source) throws TransformerException
{
StringResult result = new StringResult();
transform(source, result);
return result.toString();
}
private void transform(Source source, Result result)
throws TransformerException,
TransformerConfigurationException, TransformerFactoryConfigurationError {
TransformerFactory.newInstance().newTransformer().transform(source, result);
}
prints: <?xml version="1.0" encoding="UTF-8"?><plus
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns=""><a xmlns="">1
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]