jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/message/AbstractMessageImpl.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
118 /** |
118 /** |
119 * Copy constructor. |
119 * Copy constructor. |
120 */ |
120 */ |
121 protected AbstractMessageImpl(AbstractMessageImpl that) { |
121 protected AbstractMessageImpl(AbstractMessageImpl that) { |
122 this.soapVersion = that.soapVersion; |
122 this.soapVersion = that.soapVersion; |
|
123 this.copyFrom(that); |
123 } |
124 } |
124 |
125 |
125 @Override |
126 @Override |
126 public Source readEnvelopeAsSource() { |
127 public Source readEnvelopeAsSource() { |
127 return new SAXSource(new XMLReaderImpl(this), XMLReaderImpl.THE_SOURCE); |
128 return new SAXSource(new XMLReaderImpl(this), XMLReaderImpl.THE_SOURCE); |
148 public <T> T readPayloadAsJAXB(XMLBridge<T> bridge) throws JAXBException { |
149 public <T> T readPayloadAsJAXB(XMLBridge<T> bridge) throws JAXBException { |
149 return bridge.unmarshal(readPayloadAsSource(), |
150 return bridge.unmarshal(readPayloadAsSource(), |
150 hasAttachments()? new AttachmentUnmarshallerImpl(getAttachments()) : null ); |
151 hasAttachments()? new AttachmentUnmarshallerImpl(getAttachments()) : null ); |
151 } |
152 } |
152 |
153 |
153 /** |
154 public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException { |
154 * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)} |
|
155 */ |
|
156 @Override |
|
157 public void writeTo(XMLStreamWriter w) throws XMLStreamException { |
|
158 String soapNsUri = soapVersion.nsUri; |
155 String soapNsUri = soapVersion.nsUri; |
159 w.writeStartDocument(); |
156 w.writeStartDocument(); |
160 w.writeStartElement("S","Envelope",soapNsUri); |
157 w.writeStartElement("S","Envelope",soapNsUri); |
161 w.writeNamespace("S",soapNsUri); |
158 w.writeNamespace("S",soapNsUri); |
162 if(hasHeaders()) { |
159 if(hasHeaders()) { |
167 } |
164 } |
168 w.writeEndElement(); |
165 w.writeEndElement(); |
169 } |
166 } |
170 // write the body |
167 // write the body |
171 w.writeStartElement("S","Body",soapNsUri); |
168 w.writeStartElement("S","Body",soapNsUri); |
172 |
169 } |
|
170 |
|
171 /** |
|
172 * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)} |
|
173 */ |
|
174 @Override |
|
175 public void writeTo(XMLStreamWriter w) throws XMLStreamException { |
|
176 writeToBodyStart(w); |
173 writePayloadTo(w); |
177 writePayloadTo(w); |
174 |
178 |
175 w.writeEndElement(); |
179 w.writeEndElement(); |
176 w.writeEndElement(); |
180 w.writeEndElement(); |
177 w.writeEndDocument(); |
181 w.writeEndDocument(); |