Results 1 to 8 of 8

Thread: Spring Integration Headers

  1. #1
    Join Date
    Nov 2004
    Posts
    16

    Default 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. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Can you post your configuration?

  3. #3
    Join Date
    Nov 2004
    Posts
    16

    Default

    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 org.springframework.integration.endpoint.EventDrivenConsumer@3aeacb9c | 
    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]

  4. #4
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

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

  5. #5
    Join Date
    Nov 2004
    Posts
    16

    Default

    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(:)'

  6. #6
    Join Date
    Nov 2004
    Posts
    16

    Default

    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()?

  7. #7
    Join Date
    Nov 2004
    Posts
    16

    Default

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

  8. #8
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •