Announcement Announcement Module
Collapse
No announcement yet.
Select Web Service operation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Select Web Service operation

    Using Web Service Outbound Gateway, how do I select which operation (i.e. SOAP Action) I want to call?
    Code:
    <ws:outbound-gateway id="simpleGateway"
                         request-channel="inputChannel"
                         uri="http://example.org"/>
    Is it possible to bind each operation in a Gateway Interface to the a given Web Service Operation? Using annotations?

    Thanx for your help

  • #2
    Before sending the outbound Message, you can add a header with the name defined in the constant: WebServiceHeaders.SOAP_ACTION

    The value of that header will then be set as the SoapAction header in the created SOAP Message.

    The WebServices sample includes this with a generic header-enricher (hence, the actual name is used instead of the constant):
    Code:
    <chain input-channel="fahrenheitChannel" output-channel="celsiusChannel">
        <header-enricher>
            <header name="springintegration_ws_soapAction" value="http://tempuri.org/FahrenheitToCelsius"/>
        </header-enricher>
        <ws:outbound-gateway uri="http://www.w3schools.com/webservices/tempconvert.asmx"/>
    </chain>

    Comment


    • #3
      Is it possible to do something like:
      Code:
      public interface TempConvertGateway {
      
           @Gateway(requestChannel="fahrenheitChannel", replyChannel="celsiusChannel")
           @Header(name="soapAction",value="http://tempuri.org/FahrenheitToCelsius")
           int convertFahrenheitToCelsius(int temp);
      }

      Comment


      • #4
        Actually, you should be able to do something like this:
        Code:
        public interface TempConvertGateway {
        
             @Gateway(requestChannel="fahrenheitChannel", replyChannel="celsiusChannel")
             int convertFahrenheitToCelsius(int temp, @Header(WebServiceHeaders.SOAP_ACTION) String soapAction);
        }
        That means you need to pass the soap action value when calling the gateway, but hard-coding such a value in an annotation is probably not a good idea.

        Comment


        • #5
          Originally posted by Mark Fisher View Post
          That means you need to pass the soap action value when calling the gateway, but hard-coding such a value in an annotation is probably not a good idea.
          I don't think the SOAP Action will change, so I don't mind putting in the code. It's what I am going to do, place it in the caller code.

          I thank you for your help.

          Comment


          • #6
            No problem. I hope that works well for you. Hardcoding in the caller is probably better than hardcoding in the annotation. At least it could be refactored in the future to use Dependency Injection.

            Comment

            Working...
            X