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

  • HttpInvoker

    Hi,
    Is there a built-in message handler implementation for invoking an external and independent servlet via GET or POST? The HttpInvoker has a requirement that the server-side must implement Spring as well. If we have no control on the external servlet, how do we simply invoke a servlet and then wait for a http response where the parameters are simply Strings? Is there a way to use httpinvoker for this?

    If there is none, the only thing I could think of is to implement your own MessageHandler and use the typical java.net.URL. I thought there must something like a ws handler for http?

    Thanks.

  • #2
    This is something we are planning to implement for 1.1.

    Please feel free to open an issue in JIRA.

    Comment


    • #3
      Thanks for the quick response.

      A Jira issue has been raised. (jira.springframework.org/browse/INT-470)

      Comment


      • #4
        This endpoint implementation has progressed quite a bit, and it will be included in the upcoming 1.0.2 release. In the meantime, please have a look and provide feedback so that we can consider any suggestions prior to the actual release.

        Here is the code:
        https://src.springframework.org/svn/...dEndpoint.java

        Thanks,
        Mark

        Comment


        • #5
          My previous comment was actually about the *inbound* endpoint and not the outbound version. We will potentially be adding the outbound endpoint in 1.0.2, but it's likely to be in 1.0.3 instead. Now that the Spring 3.0 RestTemplate is available in a milestone, we are going to be making sure that this outbound endpoint progresses in a way that will be compatible with that, since it will be used as the basis for Spring Integration 2.0's outbound HTTP adapter. Therefore, it may require a bit more time (and we are trying to get 1.0.2 out ASAP).

          However, feedback on the inbound endpoint would still be very much appreciated!

          Comment


          • #6
            True, I was looking forward more on the outbound type. My application currently uses a customized http invoker and when the outbound type is ready (in 1.0.3?), I am hoping that it would simply be replacing that endpoint with the new one without affecting the other components.

            Does being compatible with the RestTemplate mean that the outbound type adapter will be dependent on and require Spring 3.0? How about the planned dependencies for Spring Integration 2.0?

            Regarding the inbound adapter, I like the way that you can just set a View or throw back any Serializable payload or Message and it can construct the response for you. Unfortunately, I cannot test this since my app doesn't use it now.

            I noticed one thing though, since this inbound endpoint extends SimpleMessagingGateway, you can actually set a timeout for sendAndReceive. If a request timed out, it looks like the reply is null and HttpServletResponse.SC_OK will always be returned.

            Comment


            • #7
              We are only going to require Spring 3.0 starting with Spring Integration 2.0. Therefore, even though we are planning to add outbound HTTP for 1.0.x, it will not yet be based on RestTemplate. I just want to make sure that its aligned with the direction we will be going in SI 2.0.

              Thanks for pointing out the timeout issue! I'll add a null check and create an appropriate response.

              Comment


              • #8
                I modified the request handling method so that a timeout for handling a reply no longer produces a SC_OK response. Instead, it will throw a MessageTimeoutException. That can be then directed to an appropriate error page based on web.xml mappings (or a Spring MVC HandlerExceptionResolver).

                Comment


                • #9
                  I'm planning to have something committed for the outbound HTTP adapter soon (by monday if all goes well). Please keep an eye on the status via the JIRA issue: http://jira.springframework.org/browse/INT-584

                  It would be great to get some feedback once the initial code is available. At this point, it's probably going to be quite simple. Basically, you can pass a byte array, String, or Serializable payload which will then be written to a request. The response will be written to a reply Message payload as bytes, or if it has a "text/*" Content-Type, it will be written as a String.

                  I have a working prototype and may check it in even sooner than Monday, but it is very likely to change before 1.0.2. The goal is to actually include it in 1.0.2 though rather than waiting for 1.0.3. We'll see how that goes...

                  Comment

                  Working...
                  X