Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-4951

Incomplete document transformation into SOAP body

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.5.4
    • None
    • saaj
    • None
    • Java 6

    Description

      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

      Attachments

        1. axis2-test.zip
          3 kB
          Lukas Krecan

        Activity

          People

            Unassigned Unassigned
            dart0 Lukas Krecan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: