You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Lukas Krecan (JIRA)" <ji...@apache.org> on 2011/02/07 18:05:57 UTC

[jira] Created: (AXIS2-4951) Incomplete document transformation into SOAP body

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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] Updated: (AXIS2-4951) Incomplete document transformation into SOAP body

Posted by "Lukas Krecan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-4951?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukas Krecan updated AXIS2-4951:
--------------------------------

    Attachment: axis2-test.zip

Test project. If you remove axis2-jaxws from pom.xml the test passes

> 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
>         Attachments: axis2-test.zip
>
>
> 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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org