SWS-1018 - Move creation of an empty SOAP 1.1 envelope to the factory.

Backported to 2.x.
This commit is contained in:
Jamin Hitchcock
2018-09-13 12:25:24 -05:00
committed by Greg Turnquist
parent 738eb701bf
commit 743fb29e50
2 changed files with 10 additions and 4 deletions

View File

@@ -57,6 +57,7 @@ import org.springframework.ws.transport.TransportOutputStream;
* wraps a {@link SOAPMessage}.
*
* @author Arjen Poutsma
* @author Greg Turnquist
* @see SOAPMessage
* @since 1.0.0
*/
@@ -114,10 +115,6 @@ public class SaajSoapMessage extends AbstractSoapMessage {
Assert.notNull(soapMessage, "soapMessage must not be null");
saajMessage = soapMessage;
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
MimeHeaders headers = soapMessage.getMimeHeaders();
if (ObjectUtils.isEmpty(headers.getHeader(TransportConstants.HEADER_SOAP_ACTION))) {
headers.addHeader(TransportConstants.HEADER_SOAP_ACTION, "\"\"");
}
this.messageFactory = messageFactory;
}

View File

@@ -35,6 +35,7 @@ import org.xml.sax.SAXParseException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.ws.InvalidXmlException;
import org.springframework.ws.soap.SoapMessageCreationException;
@@ -54,6 +55,7 @@ import org.springframework.ws.transport.TransportInputStream;
* factory is injected, the {@link #setSoapVersion(org.springframework.ws.soap.SoapVersion)} property is ignored.
*
* @author Arjen Poutsma
* @author Greg Turnquist
* @see org.springframework.ws.soap.saaj.SaajSoapMessage
* @since 1.0.0
*/
@@ -290,6 +292,13 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
soapMessage.setProperty(entry.getKey(), entry.getValue());
}
}
if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(this.messageFactoryProtocol)) {
MimeHeaders headers = soapMessage.getMimeHeaders();
if (ObjectUtils.isEmpty(headers.getHeader(TransportConstants.HEADER_SOAP_ACTION))) {
headers.addHeader(TransportConstants.HEADER_SOAP_ACTION, "\"\"");
}
}
}
public String toString() {