How to consume REST service (frtom Get method)

Hi,

I know it is a classic subject, but I did not found any example over the net :

I have a service flow which consumes an external REST service (resource A), and I’m calling it with the POST method. I’ve used the http service, and configured it (url, method, data, auth…) flow, and then all works fine.

Now, I have a new resource B from the same REST service but this one works with a GET method.
How the data has to be transmit in the URL please ?

I’ve tried many ways :

  • to send a string data to the http\data\string
  • to send a string data to the http\data\arg
  • to send the a string and converting it with Json

but nothing seems to work, I’m sure I’m missing a little details…

I’ve looked into all the 9.8 documentations without finding any example. So if you could give me the name of the documentation, I would appreciate that too 8)

Regards

HI,

Below is a sample which worked for me.

Hope you are able to hit the GET request on browser and getting response.

Say the URL looks like
http://localhost:5555/rest/CacheChannel/REST/new_rest?TEST=1234

I used pub.client.http with below inputs.

For url input supply the url without parameters as below
http://localhost:5555/rest/CacheChannel/REST/new_rest

method :: set this as GET

data/string :: supply the parameters as below
?TEST=232323

This will return you bytes in response, you can convert this to string using bytesToSting. Here the response will be in XML.

Thanks
Abdul Bari Khan

Thanks for your reply Barry, unfortunaltely, I have already tried this but the HTTPS URL below is difficult to the test (needs authorization) :
https://espaceclient.sepalia.fr/rcte/bpi/ibantobic?iban=1000

but the REST web service returns header/statusMessage = NOT FOUND

Here is in ATTACHED file, the test I’ve made in SoapUI with a test IBAN value. Like you can see, when the REST service succeeds, it returns a BIC value.

In SoapUI, if I test a standard GET call : “URL?iban=value”, the reply returned is the same as in webMethods : NOT FOUND
but if you watch into SoapUI param, you can see that the param must be a TEMPLATE/RESOURCE with the {iban} param.

Maybe it is not a standard GET to do with the Designer ?

Regards

When I do some POST calls (for other operations), I set “Headers\Content-type = application/xml” for it to work.

For GET, do you leave it empty ?

Can you confirm if the GET method is implemented on the target.

Tried dropping the GET implementation in my local and i am getting the same response.

Hi,

I’ve tried that call and it is ok :
https://espaceclient.sepalia.fr/rcte/bpi/ibantobic/FR11

I had just to concate variable path with the prefix URL.

Thanks for your help
Regards