Announcement Announcement Module
Collapse
No announcement yet.
HTTP Web request and web serivce client invocation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTP Web request and web serivce client invocation

    Hi,

    I want to invoke a web service and send the response back to a web page as a response to same http request in the same thread.

    Can you please help me with the example on how to do this using ws-outbound-gateway ?

    All the examples I am finding is placing a response from web service on to a reply channel, which means that my http request thread has to some how get the response from that "reply-channel" and I don't see how to do that.

    Thanks in advance.

  • #2
    Hi!

    In general it doesn't matter from where and how you call a web service via <ws:outbound-gateway>.
    You have a 'request-channel' on the <ws-outbound-gateway> and it is an entry point for external service.
    1. If your HTTP is <http:inbound-gateway> it's just enough to connect it with <ws:outbound-gateway> through 'request-channel'
    https://github.com/SpringSource/spri...ter/basic/http
    https://github.com/SpringSource/spri...iate/rest-http
    2. If your request is handled by @Controller, you need to introduce some Messaging Gateway: http://static.springsource.org/sprin...ingle/#gateway. And, of course, invoke your <ws:outbound-gateway> from there:
    https://github.com/SpringSource/spri...tbound-gateway

    and so forth

    is placing a response from web service on to a reply channel, which means that my http request thread has to some how get the response from that "reply-channel"
    HTML Code:
    <http:inbound-gateway request-channel="ws-request" reply-channel="ws-response"/>
    
    <ws:outbound-gateway request-channel="ws-request" reply-channel="ws-response"/>
    But as you see it looks a bit askew. There should be more logic around transforming as for request as for response inside the flow between "ws-request" & "ws-response" channels.
    By the way: for 'inbound-gateway' 'request-channel' means where to send incoming request. 'reply-channel' - where to wait response.
    For 'outbound-gateway' 'request-channel' - where to wait request, 'reply-channel' - where to send response.

    Is it clear?

    Take care,
    Artem

    Comment

    Working...
    X