[SWS-1018] SaajSoapMessage created with default (empty) SoapEnvelope Created: 09/May/18  Updated: 13/Sep/18  Resolved: 13/Sep/18

Status: Closed
Project: Spring Web Services
Component/s: Core
Affects Version/s: 3.0.1
Fix Version/s: 2.4.3, 3.0.4

Type: Bug Priority: Major
Reporter: Sachin Lad Assignee: Greg Turnquist
Resolution: Complete Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is duplicated by SWS-1019 RequestCreators withSoapEnvelope can ... Closed
Pull Request URL: https://github.com/spring-projects/spring-ws/pull/119


It seems like with the fix for SWS-981 check for SOAP 1.1 was added. This results in setting default/empty SoapEnvelope for SaajSoapMessage.


public SaajSoapMessage(SOAPMessage soapMessage, boolean langAttributeOnSoap11FaultString, MessageFactory messageFactory) {
   Assert.notNull(soapMessage, "soapMessage must not be null");
   saajMessage = soapMessage;
   this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
   this.messageFactory = messageFactory;
   if (SoapVersion.SOAP_11.equals(getVersion())) {
      MimeHeaders headers = soapMessage.getMimeHeaders();
      if (ObjectUtils.isEmpty(headers.getHeader(TransportConstants.HEADER_SOAP_ACTION))) {
         headers.addHeader(TransportConstants.HEADER_SOAP_ACTION, "\"\"");

 Invoking getVersion() results in introspection for SoapEnvelope. This constructor is invoked as part of createMessage() method which sets the soapMessage in doWithMessage() method after the SaajSoapMessage is initialized.


public final WebServiceMessage createMessage(WebServiceMessageFactory messageFactory) throws IOException {
   WebServiceMessage message = messageFactory.createWebServiceMessage();
   return message;

We started to see our integration tests failing with this upgrade.  

Comment by Tomas Hudec [ 14/May/18 ]

lol. I create very similar bug right after yours. Check how you can temporary fix it: https://jira.spring.io/browse/SWS-1019

Comment by jaminh [ 21/Jun/18 ]

I tried addressing this issue by moving the addition of the empty SoapAction for SOAP 1.1 messages to the postProcess method of the SaajSoapMessageFactory. This eliminates the need to look at the envelope to figure out the version since we can just look at the messageFactoryProtocol of the factory. If you want you can try running against https://github.com/jaminh/spring-ws/tree/SWS-1018 to see if that fixes the issue for you.

Comment by Greg Turnquist [ 13/Sep/18 ]

Empty envelope initialization moved to SaajSoapMessageFactory based on jaminh's work and backported to 2.x.


Generated at Tue Feb 25 18:37:34 UTC 2020 using Jira 7.13.8#713008-sha1:1606a5c1e7006e1ab135aac81f7a9566b2dbc3a6.