Uploaded image for project: 'Axiom'
  1. Axiom
  2. AXIOM-430

Inconsistent serialization of SOAPEnvelope

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.13
    • 1.2.15
    • DOOM, LLOM
    • None

    Description

      The SOAPEnvelopeImpl#internalSerialize method contains code that skips the serialization of the SOAP header if it is empty. Presumably this code is there because SOAPFactory#getDefaultEnvelope() always creates a SOAP header, but one doesn't want that header to appear in the output if there are no header blocks. However, this only works when the SOAPEnvelope is serialized to an XMLStreamWriter, OutputStream or Writer. The header is still present in the sequence of events produced by getXMLStreamReader or getSAXSource. This can be shown using the following piece of code:

      SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
      SOAPEnvelope envelope = factory.getDefaultEnvelope();
      factory.createOMElement(new QName("urn:test", "test", "p"), envelope.getBody());
      envelope.serialize(System.out);
      System.out.println();
      TransformerFactory.newInstance().newTransformer().transform(envelope.getSAXSource(true), new StreamResult(System.out));
      

      The output is:

      <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><p:test xmlns:p="urn:test"/></soapenv:Body></soapenv:Envelope>
      <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soapenv:Body><p:test xmlns:p="urn:test"/></soapenv:Body></soapenv:Envelope>
      

      In addition to that, SOAPEnvelopeImpl#internalSerialize also skips serialization of whitespace and comments.

      Attachments

        Activity

          People

            veithen Andreas Veithen
            veithen Andreas Veithen
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: