Announcement Announcement Module
Collapse
No announcement yet.
SimpleWebServiceInboundGateway invoked with empty SOAP header Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleWebServiceInboundGateway invoked with empty SOAP header

    Hi,

    I have following SI configuration

    Code:
    	<bean id="endpointMapping" class="org.springframework.ws.soap.server.endpoint.mapping.SoapActionEndpointMapping">  
    	     <property name="mappings">  
    	         <props>  
                     <prop key="CreateUser">createUserEndpoint</prop>  
    	     </property>
    	</bean>    
    	<ws:inbound-gateway id="createUserEndpoint"	request-channel="createUserChannel" reply-channel="responseState"/>
    However I cannot obtain a SOAP header. WebServiceMessage which come into SimpleWebServiceInboundGateway has empty SOAP header.
    I'm not sure where problem is.

    Incoming request

    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:wsc="http://custom/common" xmlns:ws="http://custom/user">
       <soapenv:Header>
          <wsc:auth>
             <wsc:App>DFL</wsc:App>
             <wsc:Version>5</wsc:Version>
          </wsc:AutHeader>
       </soapenv:Header>
       <soapenv:Body>
          <ws:CreateUserInputArgs>
    			<ws:UserData>
    				<ws:Id>1</ws:Id>
    				<ws:UserType>F</ws:UserType>
                </ws:UserDataId>
             </ws:UserData>
          </ws:CreateUserInputArgs>
       </soapenv:Body>
    </soapenv:Envelope>
    What could be a problem?
    I use spring-ws 1.5.9

  • #2
    Trace log settings
    Code:
    log4j.logger.org.springframework.ws.client.MessageTracing.received=TRACE
    Header exist in incoming request but not passed into endpoind. How can I access SOAP header in SI?
    Last edited by molyakov; Mar 1st, 2010, 12:24 PM.

    Comment


    • #3
      SimpleWebServiceInboundGateway implements MessageEndpoint interface and thus should operate on a whole MessageContext rather than just the payload. MessageContext should have SOAP header from incoming request.
      How this header can be accessed?

      Comment


      • #4
        The SimpleWebServiceInboundGateway does interact with MessageContext, but by default it passes only the received WebServiceMessage's body as the payload of a Spring Integration Message. If the request is a SoapMessage, it copies the SOAP headers into the Spring Integration MessageHeaders. So, you should be able to retrieve them by calling message.getHeaders().get(..).

        If you want to pass the request WebServiceMessage itself (rather than just the payload), then you can set the "extract-payload" value to "false" on the inbound-gateway.

        Hope that helps.
        -Mark

        Comment


        • #5
          Originally posted by Mark Fisher View Post
          If the request is a SoapMessage, it copies the SOAP headers into the Spring Integration MessageHeaders. So, you should be able to retrieve them by calling message.getHeaders().get(..).

          -Mark
          I use SOAP 1.1 + SAAJ message factory + SOAPAction endpoint mapping. SimpleWebServiceInboundGateway does not copy my SOAP header into SI message headers.

          Code:
          		if (request instanceof SoapMessage) {
          			SoapMessage soapMessage = (SoapMessage) request;
          			SoapHeader soapHeader = soapMessage.getSoapHeader();
          			if (soapHeader != null) {
          				Iterator<?> iter = soapHeader.getAllAttributes();
          				while (iter.hasNext()) {
          					QName name = (QName) iter.next();
          					builder.setHeader(name.toString(), soapHeader.getAttributeValue(name));
          				}
          			}
          		}
          In my case SoapHeader has no any attributes. I expect that SoapHeader(Soap11Header) wsc:auth itself should be copied into message header as a DOM or as a String.
          Code:
          <wsc:auth>
                   <wsc:App>DFL</wsc:App>
                   <wsc:Version>5</wsc:Version>
          </wsc:auth>
          Is that possible?


          Originally posted by Mark Fisher View Post
          If you want to pass the request WebServiceMessage itself (rather than just the payload), then you can set the "extract-payload" value to "false" on the inbound-gateway.
          -Mark
          Yes, it works. In such case SI message payload contains SoapMessage and I can access header:

          Code:
          		if (request instanceof SoapMessage) {
          			SoapMessage soapMessage = (SoapMessage) request;
          			SoapHeader soapHeader = soapMessage.getSoapHeader();
          	        Iterator  headerIterator = soapHeader.examineAllHeaderElements();
          	        while (headerIterator.hasNext()) {
          	            SoapHeaderElement headerElement = (SoapHeaderElement) headerIterator.next();
          	            QName headerName = headerElement.getName();
          	            logger.debug("Soap11Header: " + headerName);
          Source source = headerElement.getSource(); // This is my Header !!!!
                      
          	            
          	        }        
          		}
          What can be wrong in first case when SOAP header copied into SI header?

          Thanks in advance,
          Valeriy

          Comment


          • #6
            Could you please open an issue in JIRA for this? We really should be copying over all header elements. I guess we should simply pass the DOM Document in such a case. Although, I can imagine we'll also have requests for transforming those directly to Strings, etc.

            Thank you,
            Mark

            Comment


            • #7
              Mark,

              Issue is created http://jira.springframework.org/browse/INT-1009

              Comment

              Working...
              X