Skip to content

Commit 0da6aca

Browse files
jaminhgregturn
authored andcommitted
SWS-1018 - Move creation of an empty SOAP 1.1 envelope to the factory.
To avoid SaajSoapMessage being created with an empty envelope, move the envelope creation process to SaajSoapMessageFactory.
1 parent 11ccc7f commit 0da6aca

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

spring-ws-core/src/main/java/org/springframework/ws/soap/saaj/SaajSoapMessage.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
* wraps a {@link SOAPMessage}.
5858
*
5959
* @author Arjen Poutsma
60+
* @author Greg Turnquist
6061
* @see SOAPMessage
6162
* @since 1.0.0
6263
*/
@@ -115,12 +116,6 @@ public SaajSoapMessage(SOAPMessage soapMessage, boolean langAttributeOnSoap11Fau
115116
saajMessage = soapMessage;
116117
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
117118
this.messageFactory = messageFactory;
118-
if (SoapVersion.SOAP_11.equals(getVersion())) {
119-
MimeHeaders headers = soapMessage.getMimeHeaders();
120-
if (ObjectUtils.isEmpty(headers.getHeader(TransportConstants.HEADER_SOAP_ACTION))) {
121-
headers.addHeader(TransportConstants.HEADER_SOAP_ACTION, "\"\"");
122-
}
123-
}
124119
}
125120

126121
/** Return the SAAJ {@code SOAPMessage} that this {@code SaajSoapMessage} is based on. */

spring-ws-core/src/main/java/org/springframework/ws/soap/saaj/SaajSoapMessageFactory.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
import org.springframework.beans.factory.InitializingBean;
3737
import org.springframework.util.CollectionUtils;
38+
import org.springframework.util.ObjectUtils;
3839
import org.springframework.util.StringUtils;
3940
import org.springframework.ws.InvalidXmlException;
4041
import org.springframework.ws.soap.SoapMessageCreationException;
@@ -54,6 +55,7 @@
5455
* factory is injected, the {@link #setSoapVersion(org.springframework.ws.soap.SoapVersion)} property is ignored.
5556
*
5657
* @author Arjen Poutsma
58+
* @author Greg Turnquist
5759
* @see org.springframework.ws.soap.saaj.SaajSoapMessage
5860
* @since 1.0.0
5961
*/
@@ -290,6 +292,13 @@ protected void postProcess(SOAPMessage soapMessage) throws SOAPException {
290292
soapMessage.setProperty(entry.getKey(), entry.getValue());
291293
}
292294
}
295+
296+
if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(this.messageFactoryProtocol)) {
297+
MimeHeaders headers = soapMessage.getMimeHeaders();
298+
if (ObjectUtils.isEmpty(headers.getHeader(TransportConstants.HEADER_SOAP_ACTION))) {
299+
headers.addHeader(TransportConstants.HEADER_SOAP_ACTION, "\"\"");
300+
}
301+
}
293302
}
294303

295304
public String toString() {

0 commit comments

Comments
 (0)