Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Inbound HTTP Web Service adapter?

  1. #1

    Default Inbound HTTP Web Service adapter?

    Is there an existing HTTP Web Service adapter, or a way to easily construct one with the current Spring-WS and Spring-Integration tools? We're evaluating Spring-Integration and here's two scenarios we need:
    Synchronous case:
    external HTTP Web Service client -> our HTTP Web Service Endpoint (myWS) -> JMS Request queue -> [process request] -> JMS Response Queue -> (myWS) -> return result to external HTTP client which is waiting
    Async w/callback:
    same as above, but the endpoint (myWS) does not not block, it does an ACK immediately and the result is done via pre-configured HTTP WS callback

    This is the normal sync-to-async problem, and NO, we can't just tell the client to just send us a JMS message

  2. #2
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    Quote Originally Posted by prpatel View Post
    This is the normal sync-to-async problem, and NO, we can't just tell the client to just send us a JMS message
    Yes it would be nice if you could just tell your clients to solve their own @#$ problems . So that's what I'm going to do:

    You could use a gateway or MessageChannelTemplate to solve the sync async problem. We have a generic solution for this in the framework and there is no reason you couldn't use that inside a ws implementation.

    There is in fact an issue open for this in our JIRA: http://jira.springframework.org/browse/INT-162. However it's planned for 1.2, so you'll have to use your own implementation for now.

    If you have comments or ideas it would be great if you can give your input on the JIRA issue so we don't make something you don't like later.

  3. #3
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    The initial support for inbound WS is now available. We have the following two classes:
    SimpleWebServiceInboundGateway
    MarshallingWebServiceInboundGateway

    These are available in the nightly build (and will be released with version 1.0.2). You can get the very latest version by checking out the SVN trunk or download the nightly snapshot here (or any later nightly by changing the build number):
    https://build.springframework.org/do...-424/artifacts

    These gateways are themselves Spring-WS Endpoint implementations. Therefore to use them, simply register the Spring-WS MessageDispatcherServlet in web.xml:
    Code:
      <servlet>
      	<servlet-name>ws</servlet-name>
      	<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
      </servlet>
      
      <servlet-mapping>
      	<servlet-name>ws</servlet-name>
      	<url-pattern>/ws/*</url-pattern>
      </servlet-mapping>
    Then, any Spring-WS EndpointMapping can be used. For example:
    Code:
    <bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
        <property name="mappings">
            <value>
                foo=simpleEndpoint
                bar=marshallingEndpoint
            </value>
        </property>
    </bean>
    (With the configuration above any XML with a "foo" root element name will go to the simple endpoint while any XML with a "bar" root element name will go to the marshalling endpoint.)

    Then, add the Spring Integration gateway(s):
    Code:
    <bean id="simpleEndpoint" class="org.springframework.integration.ws.SimpleWebServiceInboundGateway">
        <property name="requestChannel" ref="wsRequests"/>
    </bean>
    
    <bean id="marshallingEndpoint" class="org.springframework.integration.ws.MarshallingWebServiceInboundGateway">
        <property name="requestChannel" ref="wsRequests"/>
        <property name="marshaller" ref="someMarshaller"/>
        <property name="unmarshaller" ref="someMarshaller"/>
    </bean>
    If you get a chance to try this out, please provide feedback so that we can take any suggestions into account for the 1.0.2 release.

    Thanks,
    Mark

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    Please note that when using WS-Addressing soap headers, the endpoint mapping type should be SimpleActionEndpointMapping as described in the Spring Web Services reference manual here: http://static.springsource.org/sprin...-ws-addressing

  5. #5
    Join Date
    Nov 2008
    Location
    Swansea, Wales
    Posts
    202

    Default

    Brilliant! I've been waiting for this

    One idea I had though was instead of having an endpoint that routes to a channel having an endpoint mapper that would, something like this

    Code:
    <bean class="org.springframework.ws.server.endpoint.mapping.ChannelRoutingEndpointMapping">
        <property name="mappings">
            <value>
                foo=channelA
                bar=channelB
            </value>
        </property>
    </bean>

  6. #6
    Join Date
    Dec 2008
    Posts
    19

    Default

    I'm also very interested in an inbound WS adapter. I'll try it out when I get a chance and provide some feedback.

    One question: Does the implementation provide a WSDL that clients can access?

    Thanks,
    Bob
    --
    Bob Ganger
    Senior Software Developer
    CUBRC, Inc.
    rganger70@hotmail.com

  7. #7
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    Yes, the WSDL will be generated automatically if you just add a bean definition as described in the Spring Web Services reference manual here:
    http://static.springsource.org/sprin...-wsdl-exposure

  8. #8
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    Quote Originally Posted by rhart View Post
    One idea I had though was instead of having an endpoint that routes to a channel having an endpoint mapper that would
    Thanks for the feedback! Let me see if I can clearly explain the rationale for the approach we have taken...

    If we implemented an EndpointMapping like that, it would first need to create actual Endpoint instances behind the scenes. Beyond that, there are a couple reasons that we decided to expose Endpoint implementations rather than something at the level of an EndpointMapping. In general, we wanted to re-use the capabilities in Spring Web Services (and to automatically take advantage of future extensions). Here are a couple of the main points:
    1. Different EndpointMappings are necessary for different strategies (payload root QName, XPath expression, SoapAction, WS-Addressing)
    2. Spring Web Services already supports interceptors for EndpointMappings, and the application of these may vary for different types of mapping (e.g. distinct pre/post-interceptors for WS-Addressing)
    3. We have 2 different inbound-gateway implementations: a payload endpoint and a marshalling endpoint
    4. We already offer a lot of XML capabilities (e.g. XPath router) that can be leveraged for more fine-grained routing, but the coarse-grained routing may rely on one of the other strategies mentioned above (e.g. Soap Action)


    Does that explanation make sense?

    Regards,
    Mark

  9. #9
    Join Date
    Dec 2008
    Posts
    19

    Default

    Quote Originally Posted by Mark Fisher View Post
    Yes, the WSDL will be generated automatically if you just add a bean definition as described in the Spring Web Services reference manual here:
    http://static.springsource.org/sprin...-wsdl-exposure
    Mark,

    Thank you for the response.

    I have one other small question: Does spring-ws support publishing of wsdls using the ?wsdl notation (as opposed to the .wsdl) notation?

    Thanks,
    Bob
    --
    Bob Ganger
    Senior Software Developer
    CUBRC, Inc.
    rganger70@hotmail.com

  10. #10
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    Bob,

    The reason that Spring Web Services exposes with a .wsdl extension is that the contract-first approach decouples the contract from the service (with the endpoint as the intermediary). Therefore the WSDL is a "standalone document" as opposed to something attached to a particular service instance.

    It is explained (probably more clearly) in the Spring Web Services FAQ here:
    http://static.springsource.org/sprin...#wsdl-retrieve

Tags for this Thread

Posting Permissions

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