Announcement Announcement Module
Collapse
No announcement yet.
Spring Integration Headers Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Integration Headers

    I have a spring integration project with a ws-inbound-gateway configured with map-request-headers="*". I then use a downstream router that references header-name="SOAP-ENV:Version" . The problem I get is that that header is returned as a org.springframework.ws.soap.saaj.SaajSoapHeaderEle ment, but the header router is expecting a String.

    Is there a way to execute an SpEL expression, xpath, or something else to extract the string from the element that is apparently being created?

  • #2
    Can you post your configuration?

    Comment


    • #3
      Code:
          <int-ws:inbound-gateway id="ws-inbound-gateway"
                                  request-channel="request" 
                                  reply-channel="reply" 
                                  mapped-request-headers="*"/>
      	<int:header-value-router id="versionRouter" 
      	                         input-channel="request"
      	                         header-name="SOAP-ENV:Version"/>
      Here's the log file:

      Code:
      2012-10-04 15:49:58,493 DEBUG | tomcat-http--4 | o.s.integration.ws.DefaultSoapHeaderMapper              | headerName=[SOAP-ENV:Version] WILL be mapped, matched pattern=* | 
      2012-10-04 15:49:58,496  INFO | tomcat-http--4 | o.s.integration.endpoint.EventDrivenConsumer            | Adding {bridge:null} as a subscriber to the 'reply' channel | 
      2012-10-04 15:49:58,496  INFO | tomcat-http--4 | org.springframework.integration.channel.DirectChannel   | Channel 'reply' has 1 subscriber(s). | 
      2012-10-04 15:49:58,496  INFO | tomcat-http--4 | o.s.integration.endpoint.EventDrivenConsumer            | started [email protected]cb9c | 
      2012-10-04 15:49:58,497 DEBUG | tomcat-http--4 | org.springframework.integration.channel.DirectChannel   | preSend on channel 'request', message: [Payload=javax.xml.transform.dom.DOMSource@cdd8cfc][Headers={timestamp=1349383798497, id=85fe142b-4220-4577-a182-b09500da7d10, errorChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@2552fafd, replyChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@2552fafd, SOAP-ENV:Version=org.springframework.ws.soap.saaj.SaajSoapHeaderElement@6adc0b2f}] | 
      2012-10-04 15:49:58,497 DEBUG | tomcat-http--4 | o.springframework.integration.router.HeaderValueRouter  | (inner bean)#1 received message: [Payload=javax.xml.transform.dom.DOMSource@cdd8cfc][Headers={timestamp=1349383798497, id=85fe142b-4220-4577-a182-b09500da7d10, errorChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@2552fafd, replyChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@2552fafd, SOAP-ENV:Version=org.springframework.ws.soap.saaj.SaajSoapHeaderElement@6adc0b2f}] | 
      2012-10-04 15:49:58,497 DEBUG | tomcat-http--4 | o.springframework.integration.router.HeaderValueRouter  | Unable to attempt conversion of Message payload types. Component 'versionRouter' has no explicit ConversionService reference, and there is no 'integrationConversionService' bean within the context. | 
      2012-10-04 15:49:58,503  WARN | tomcat-http--4 | o.s.integration.ws.SimpleWebServiceInboundGateway       | failure occurred in gateway sendAndReceive | 
      org.springframework.integration.MessagingException: unsupported return type for router [class org.springframework.ws.soap.saaj.SaajSoapHeaderElement]

      Comment


      • #4
        Try this code and let me know
        Code:
        <int:router input-channel="request" expression="headers.SOAP-ENV:Version.toString()". . ./>

        Comment


        • #5
          It doesn't appear to like the :

          Code:
          Property 'expressionString' threw exception; nested exception is org.springframework.expression.spel.SpelParseException: EL1041E:(pos 16): After parsing a valid expression, there is still more data in the expression: 'colon(:)'

          Comment


          • #6
            I switched the expression to this:
            Code:
            headers['SOAP-ENV:Version'].toString()
            And now I'm getting this:
            Code:
            failed to resolve channel name 'org.springframework.ws.soap.saaj.SaajSoapHeaderElement@7407beda'
            . So I think we're getting somewhere, just need something besides toString()?

            Comment


            • #7
              headers['SOAP-ENV:Version'].getText() worked. Thanks Oleg!

              Comment


              • #8
                I was just gonna suggest that, but glad you found it.

                Comment

                Working...
                X