axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukas Krecan (JIRA)" <>
Subject [jira] Created: (AXIS2-4951) Incomplete document transformation into SOAP body
Date Mon, 07 Feb 2011 17:05:57 GMT
Incomplete document transformation into SOAP body

                 Key: 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=\"\" xmlns:xsi=\"\"><a>1</a><b>2</b></plus>";
	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()));
		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=""
xmlns=""><a xmlns="">1

This message is automatically generated by JIRA.
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message