How to receive LONGCHAR/JsonObject/Temp-Table from REST clie

Posted by mdanwarh on 02-Mar-2016 06:19

Hi ,

I have created a method inside my class file :

METHOD PUBLIC VOID getRequestData( INPUT ilcRequest AS LONGCHAR , OUTPUT myjsonObj AS LONGCHAR):

DEFINE VARIABLE vlOk           AS LOGICAL NO-UNDO.

vlOk = TEMP-TABLE  ttRequestParam:READ-JSON( "LONGCHAR", ilcRequest, "empty") NO-ERROR. 

...

END METHOD.

I send a JSON input from Google's Advance REST Client Application to the above method

{

"ttRequestParam": {
"whereClause": " OrderNum = 1 ",
"className": "Order",
"tableName": "Order",
"ID": "Order"
}
}

But, I am not able to receive these values in ttRequestParam. If am doing the same thing from Progress 4GL client it works fine.

My input and output verb association is mentioned below.  Where exactly do I need to map my input longchar variable ?

Posted by mdanwarh on 02-Mar-2016 21:30

Awesome !!!. It working now. You made my day. Thanks a lot  :-)

Posted by egarcia on 02-Mar-2016 09:03

Hello,

The new screenshot shows that you are mapping ilcRequest to a parameter within the body, not the body per se.

Try mapping dragging the mapping line to the Body node instead of the within the parameter.

Take a look at the following screenshot to see how it looks like:

community.progress.com/.../image3.png

from the article:

community.progress.com/.../2190

If you map items as parameters rather than to the body, the you need to wrap the input in a request object and the output in a response object.

Please let me know how it goes.

Thanks.

All Replies

Posted by egarcia on 02-Mar-2016 06:37

Hello,

I think that for what you are trying to do, you would want to map your parameters to the body.

Also, the data that you are sending seems to be missing - - to indicate an array:

{

"ttRequestParam": [{

"whereClause": " OrderNum = 1 ",

"className": "Order",

"tableName": "Order",

"ID": "Order"

}]

}

I hope this helps.

Posted by mdanwarh on 02-Mar-2016 07:29

Thanks for the reply, But still I am not getting the values in temp-table ttRequestParam. Therefore the output is blank. If I hardcode the whereClause, className and tableName in my class file, I am getting the output

Please help !!!

Thanks in advance.

Posted by egarcia on 02-Mar-2016 09:03

Hello,

The new screenshot shows that you are mapping ilcRequest to a parameter within the body, not the body per se.

Try mapping dragging the mapping line to the Body node instead of the within the parameter.

Take a look at the following screenshot to see how it looks like:

community.progress.com/.../image3.png

from the article:

community.progress.com/.../2190

If you map items as parameters rather than to the body, the you need to wrap the input in a request object and the output in a response object.

Please let me know how it goes.

Thanks.

Posted by mdanwarh on 02-Mar-2016 21:30

Awesome !!!. It working now. You made my day. Thanks a lot  :-)

This thread is closed