ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » REST call with HTTPRequest GET with no message body

Post new topic  Reply to topic
 REST call with HTTPRequest GET with no message body « View previous topic :: View next topic » 
Author Message
grebenar
PostPosted: Sat Oct 31, 2020 1:41 pm    Post subject: REST call with HTTPRequest GET with no message body Reply with quote

Novice

Joined: 10 Apr 2006
Posts: 22
Location: Budapest, Hungary

Hello,

I'm trying to find out how to issue a HTTP call with no message body, using HTTPRequest node.

What I'd like to do is to call a REST service with HTTP GET method, which uses only the URL as parameter specification. Like this:
http://dummy.restapiexample.com/api/v1/employees

I've read many documents, and this type of HTTP calls don't need a message body.

However, in HTTPRequest node, the "Advanced/Request message location in tree" parameter is required, and I cannot find the way to send an empty message. If I set the parameter to InputRoot.BLOB, and this domain does not exists, I get an error message "Navigation to requested message location failed.".

I was able to bypass the problem by sending "something" in the body as BLOB (the receiver does not care about the content, when the HTTP method is GET), but I feel this is not elegant.

Do you have any idea?

(ps. I cannot use the REST* nodes, because I'm building a generic proxy, and I don't want to specify the definitions file)

Thanks,
Robert
Back to top
View user's profile Send private message
abhi_thri
PostPosted: Sun Nov 01, 2020 2:29 am    Post subject: Re: REST call with HTTPRequest GET with no message body Reply with quote

Knight

Joined: 17 Jul 2017
Posts: 516
Location: UK

grebenar wrote:

However, in HTTPRequest node, the "Advanced/Request message location in tree" parameter is required, and I cannot find the way to send an empty message. If I set the parameter to InputRoot.BLOB, and this domain does not exists, I get an error message "Navigation to requested message location failed.".


hi...have you tried leaving that setting as the default, i.e just as 'InputRoot'
Back to top
View user's profile Send private message
grebenar
PostPosted: Sun Nov 01, 2020 3:49 pm    Post subject: Reply with quote

Novice

Joined: 10 Apr 2006
Posts: 22
Location: Budapest, Hungary

Hello,
Thanks for your reply, I tried it for your suggestion.
Unfortunately I get "Invalid parser sequence" error when I call the HTTPRequest node with a payload (I have data in InputRoot.BLOB.BLOB). When I call without payload (InputRoot.BLOB is NULL), it works.
Now I'd like to have both cases work with the same HTTPRequest node.
Back to top
View user's profile Send private message
abhi_thri
PostPosted: Sun Nov 01, 2020 10:52 pm    Post subject: Reply with quote

Knight

Joined: 17 Jul 2017
Posts: 516
Location: UK

grebenar wrote:
I'm trying to find out how to issue a HTTP call with no message body, using HTTPRequest node.


hi...your initial requirement was to make the call without any message body which now works...

grebenar wrote:
Hello,
Thanks for your reply, I tried it for your suggestion.
Unfortunately I get "Invalid parser sequence" error when I call the HTTPRequest node with a payload (I have data in InputRoot.BLOB.BLOB)


...so why are you now trying to send data now, what has changed?

Anyway, "Invalid parser sequence" suggests that output message headers are not created in the correct order. What happens when you try setting the value to "InputRoot.BLOB.BLOB", if that also fails with the same error try inspecting the order of the message headers.
Back to top
View user's profile Send private message
grebenar
PostPosted: Mon Nov 02, 2020 12:50 am    Post subject: Reply with quote

Novice

Joined: 10 Apr 2006
Posts: 22
Location: Budapest, Hungary

Quote:
...so why are you now trying to send data now, what has changed?


I'm building a centralized proxy, that provides virtual URLs for clients to call web services, and logs the messages.
It might get a HTTP GET call with no body, as well as other HTTP methods like PUT, POST with message bodies.

Quote:
Anyway, "Invalid parser sequence" suggests that output message headers are not created in the correct order. What happens when you try setting the value to "InputRoot.BLOB.BLOB", if that also fails with the same error try inspecting the order of the message headers.


I was thinking of this also, but if I'm just changing the message location to "InputRoot.BLOB.BLOB", POST/PUT works immediately (but GET stops working). I'm having and idea of having two HTTPRequest nodes (one for messages with body, one for without), but I feel it lame
Back to top
View user's profile Send private message
abhi_thri
PostPosted: Mon Nov 02, 2020 1:26 am    Post subject: Reply with quote

Knight

Joined: 17 Jul 2017
Posts: 516
Location: UK

grebenar wrote:

I'm building a centralized proxy, that provides virtual URLs for clients to call web services, and logs the messages.
It might get a HTTP GET call with no body, as well as other HTTP methods like PUT, POST with message bodies.


I see...we do use a similar setup at my current client, i.e a generic HttpRequest node flow which can take in different request types. The Advanced-> Use whole input message as request is left as the default value 'InputRoot'.

To fix the issue of 'Invalid parser sequence' error try looking at what is send to the node, i.e it shouldn't have any of the MQ headers (for eg:- if the input message is coming via a queue)...it should only have Http relevant headers, eg:- Properties, HTTPRequestHeader etc. Also look at the Local envriornment properties of the node that you could override upfront so that the request is fully ready when it hits the node.
Back to top
View user's profile Send private message
grebenar
PostPosted: Mon Nov 02, 2020 2:48 am    Post subject: Reply with quote

Novice

Joined: 10 Apr 2006
Posts: 22
Location: Budapest, Hungary

Huh, your suggestions helped a lot! The Output tree order was wrong.
It should have Properties, HttpRequestHeader, BLOB. (Previously BLOB was the second)
Now both cases (GET without body, POST with body) work with "Use whole input message as request" checked.
Thanks a lot! Sometimes a little external help is needed to think out of the box 🙂

Robert
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » REST call with HTTPRequest GET with no message body
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.