OUTPUT JsonObject/ Longchar from REST services using POST me

Posted by mdanwarh on 01-Mar-2016 06:06

Hi,

I  have written below method in my class file to get JsonObject from REST services using POST method . But when I try

METHOD PUBLIC VOID getRequestData( INPUT inJson AS LONGCHAR , OUTPUT oJsonDataObj AS JsonObject ):

....

END METHOD.

but when I tried to map it, I get the following error. 

Then I tried to use Longchar instead of JsonObject,

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

....

END METHOD.

In this case I am getting the response but it is blank.

Finally, I tried to send temp- table as output. Now I am getting the data.

So, I want to know whether we can send the JSONObject / Longchar as output or not? What exactly am I missing in first 2 attempts ?

Please help!!

Thanks in advance.

All Replies

Posted by Peter Judge on 01-Mar-2016 06:14

Longchar should work. The response you posted looks like it maps correctly (assuming the output parameter name is myjsonObj).

Are you assigning it a value?
 

Posted by mdanwarh on 01-Mar-2016 06:45

Yes, I tried to run the method by progress 4GL client and I am getting the output in longchar variable as

{"ttOrder": [

{

"Ordernum": 3,

"CustNum": 66,

"OrderDate": "1997-09-23",

"ShipDate": "1997-09-28",

"PromiseDate": "1997-09-28",

"Carrier": "Standard Mail",

"Instructions": "",

"PO": "",

"Terms": "Net30",

"SalesRep": "HXM",

"BillToID": 0,

"ShipToID": 0,

"OrderStatus": "Shipped",

"WarehouseNum": 0,

"Creditcard": "American Express"

}

]}


I tried changing JsonType to Object/String/longvalue in Edit Node of Output section in Mapping defintions, but still there is not data in output.

In case JsonType -> Object I am getting

{"response":{"myjsonObj":{}}}

In case JsonType -> String I am getting

{"response":{"myjsonObj":""}}

In case JsonType -> longvalue I am getting

{"response":{"myjsonObj": 0}}

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

Now I am getting the LONGCHAR output. I have identified the issue. The issue is with input LONGCHAR variable. It is not receiving the value. Hence the output is blank.

How can I access the longchar input variable, in my class file? I tried.

1. Parsing it to JsonObject (which is working fine with local progress 4GL client)

2. Used READ-JSON to populate the longchar json into temp-table.

But still no luck :(

Am I missing something in configuration ?

This thread is closed