3

I am new to spring-xd and would like to understand is it possible to invoke an external rest api from springxd. My rest api expects a request header for GET requests and request header+message body for POST requests. How do I invoke the URL ?

In my understanding http-client is to be used, but I am not very sure how do I use it.

I havent written any stream for this case yet.

shankar
  • 33
  • 2

1 Answers1

1

You would use the url and httpMethod properties in the stream definition

http-client --url=http://... --httpMethod=GET

You will also have to set the mappedRequestHeaders to pass any custom headers that have been set up upstream.

--mappedRequestHeaders=HTTP_REQUEST_HEADERS,myHeader1,myHeader2

However, if you want to use uri variables...

url=http://somehost/foo/{bar}/{baz}

you will need a custom http-client module to add <uri-variable/> child elements to the outbound-gateway.

You will also need a custom module if you want to add headers to be mapped (via a <header-enricher/>).

Gary Russell
  • 166,535
  • 14
  • 146
  • 179