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 » Access POST parameters in compute node

Post new topic  Reply to topic
 Access POST parameters in compute node « View previous topic :: View next topic » 
Author Message
matope.mayamiko
PostPosted: Mon Jan 20, 2020 12:38 am    Post subject: Access POST parameters in compute node Reply with quote

Newbie

Joined: 20 Jan 2020
Posts: 3

Hello

I'm quite new to IBM IIB and I'm trying to develop a REST service that can be consumed by other services. I have done most of the work but my question is on the compute node. I am able to access values that I pass to the service using GET with the code below

Code:
SET myValue = InputLocalEnvironment.REST.Input.Parameters.myValue;


What I want to know is how can I access values that I send to the service using HTTP POST. I tried with the same code above but it does not work
Back to top
View user's profile Send private message
timber
PostPosted: Mon Jan 20, 2020 1:02 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1290

Are these 'values that you send to the service' supplied in
a) query parameters in the URL or
b) fields in the JSON body?

If b), then you need to access the message body in the usual way:
Code:

DECLARE myParam1 CHAR = InputBody.JSON.Data.path.to.your.field;
Back to top
View user's profile Send private message
matope.mayamiko
PostPosted: Mon Jan 20, 2020 1:23 am    Post subject: Reply with quote

Newbie

Joined: 20 Jan 2020
Posts: 3

I am passing the values as HTTP POST parameter. below is a sample raw request

Code:
POST /localhost/myServiceHTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: 158

Test=928361283&Amount=1000.00
Back to top
View user's profile Send private message
timber
PostPosted: Mon Jan 20, 2020 3:21 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1290

Quote:
I am passing the values as HTTP POST parameter
That does not answer my question. There are multiple ways to pass POST parameters.
Code:
Content-Type: application/x-www-form-urlencoded
That does answer the question, though. You are sending the parameters as x-www-form-urlencoded.

IIB does not automatically decode x-www-form-urlencoded params. You should proceed as follows:
- Insert a Trace node immediately after the HTTP node
- Set the Pattern property of the Trace node to ${Root}
- Put a message through the flow, then look carefully at the tree structure in the Trace node output.
- Write ESQL to extract the parameters from the incoming message.
Back to top
View user's profile Send private message
matope.mayamiko
PostPosted: Tue Jan 21, 2020 2:17 am    Post subject: Reply with quote

Newbie

Joined: 20 Jan 2020
Posts: 3

Thanks, I put a trace node and realised that content type of application/x-www-form-urlencoded was being passed as a BLOB. I just had to cast the blob back to a string and now I can read the parameters
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 » Access POST parameters in compute node
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.