src/share/jaxws_classes/com/sun/xml/internal/ws/message/AbstractMessageImpl.java

Print this page
rev 472 : 8036030: Update JAX-WS RI integration to latest version

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -118,10 +118,11 @@
     /**
      * Copy constructor.
      */
     protected AbstractMessageImpl(AbstractMessageImpl that) {
         this.soapVersion = that.soapVersion;
+        this.copyFrom(that);
     }
 
     @Override
     public Source readEnvelopeAsSource() {
         return new SAXSource(new XMLReaderImpl(this), XMLReaderImpl.THE_SOURCE);

@@ -148,15 +149,11 @@
     public <T> T readPayloadAsJAXB(XMLBridge<T> bridge) throws JAXBException {
         return bridge.unmarshal(readPayloadAsSource(),
             hasAttachments()? new AttachmentUnmarshallerImpl(getAttachments()) : null );
     }
 
-    /**
-     * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
-     */
-    @Override
-    public void writeTo(XMLStreamWriter w) throws XMLStreamException {
+    public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException {
         String soapNsUri = soapVersion.nsUri;
         w.writeStartDocument();
         w.writeStartElement("S","Envelope",soapNsUri);
         w.writeNamespace("S",soapNsUri);
         if(hasHeaders()) {

@@ -167,11 +164,18 @@
             }
             w.writeEndElement();
         }
         // write the body
         w.writeStartElement("S","Body",soapNsUri);
+    }
 
+    /**
+     * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
+     */
+    @Override
+    public void writeTo(XMLStreamWriter w) throws XMLStreamException {
+        writeToBodyStart(w);
         writePayloadTo(w);
 
         w.writeEndElement();
         w.writeEndElement();
         w.writeEndDocument();