Mapping multiple Datasets/temp-tables to one REST call

Posted by RWEBSTER on 15-Dec-2014 11:16

I'm sure I've done this before, and I remember struggling then too.

I need to provide a dataset and a temptable to our REST adapter code. I've got the elements mapped like this:

And I'm providing the JSON in one lump (ie one JSON object that contains the dataset and the temptable), as the body of the request.

I'm consistently met with the error "JSON value of ProDataset or temp-table parameter is invalid or empty."

Am I on the wrong track here?

Posted by knavneet on 16-Dec-2014 06:08

So, the REST Adapter receives null for both dsFormdata and ttReportOptions.
 
Since you have mapped these parameters together in an HTTP body under node names “dsFormdata” and “ttReportOptions”, your JSON input must be wrapped inside a “request” node.
 
Something like this:
===
{ “request” : {
                             “dsFormdata”:
                                                           {
                                                              “dsFormdata”: { …}
                                                              }
                     }
}
 
And
{ “request” : {
                             “ttReportOptions”:
                                                           {
                                                              “ttReportOptions”: { …}
                                                              }
                     }
}
====
I have had experience get NULL in REST Adapter because I missed creating the JSON payload wrapped inside a “request” node. Can you check if that is the case with you too.
 
 
[collapse]
From: RWEBSTER [mailto:bounce-stigdarkstar@community.progress.com]
Sent: Tuesday, December 16, 2014 2:37 PM
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] Mapping multiple Datasets/temp-tables to one REST call
 
Reply by RWEBSTER

Hi knavneet,

Yes the error I'm seeing is in the appserver logs.

The REST logs show that the parameters are being passed across as null:

2014-12-16 08:53:50.601 [DEBUG][REST] Param name: dsformdata

2014-12-16 08:53:50.601 [DEBUG][REST]    Param type: 36

2014-12-16 08:53:50.601 [DEBUG][REST]    Param ordinal: 4

2014-12-16 08:53:50.601 [DEBUG][REST]    Param mode: 1

2014-12-16 08:53:50.601 [DEBUG][REST]    Param value: <Null>

2014-12-16 08:53:50.601 [DEBUG][REST]    Param is extent: false

2014-12-16 08:53:50.602 [DEBUG][REST]    Param extent: 0

2014-12-16 08:53:50.602 [DEBUG][REST]    Param has Before Image: false

2014-12-16 08:53:50.602 [DEBUG][REST] Param name: ttReportOptions

2014-12-16 08:53:50.602 [DEBUG][REST]    Param type: 15

2014-12-16 08:53:50.602 [DEBUG][REST]    Param ordinal: 5

2014-12-16 08:53:50.602 [DEBUG][REST]    Param mode: 1

2014-12-16 08:53:50.602 [DEBUG][REST]    Param value: <Null>

2014-12-16 08:53:50.602 [DEBUG][REST]    Param is extent: false

2014-12-16 08:53:50.602 [DEBUG][REST]    Param extent: 0

2014-12-16 08:53:50.602 [DEBUG][REST]    Param has Before Image: false

This tells me that the JSON I'm providing is incorrect (or I'm providing it incorrectly). I've double checked and the JSON is valid JSON, and when parsed the structure looks like I would expect. I'm at a bit of a loss as to where to go from here.

Thanks

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

All Replies

Posted by knavneet on 15-Dec-2014 22:08

You can map multiple dataset/temptable to the Request body. The mapping snap shot that you have pasted looks correct.
 
The error you are getting is probably not related to mapping.  In which log file do you see this error – restbroker1.server.log?
 
To look at the REST Adapter logs, you may increase the serviceLoggingLevel=4 in WEB-INF/adapters/runtime.props , and look at WEB-INF/adapters/logs/<servicename>.log to see if you get some more information.
 
 
[collapse]
From: RWEBSTER [mailto:bounce-stigdarkstar@community.progress.com]
Sent: Monday, December 15, 2014 10:47 PM
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] Mapping multiple Datasets/temp-tables to one REST call
 
Thread created by RWEBSTER

I'm sure I've done this before, and I remember struggling then too.

I need to provide a dataset and a temptable to our REST adapter code. I've got the elements mapped like this:

And I'm providing the JSON in one lump (ie one JSON object that contains the dataset and the temptable), as the body of the request.

I'm consistently met with the error "JSON value of ProDataset or temp-table parameter is invalid or empty."

Am I on the wrong track here?

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by RWEBSTER on 16-Dec-2014 03:06

Hi knavneet,

Yes the error I'm seeing is in the appserver logs.

The REST logs show that the parameters are being passed across as null:

2014-12-16 08:53:50.601 [DEBUG][REST] Param name: dsformdata

2014-12-16 08:53:50.601 [DEBUG][REST]    Param type: 36

2014-12-16 08:53:50.601 [DEBUG][REST]    Param ordinal: 4

2014-12-16 08:53:50.601 [DEBUG][REST]    Param mode: 1

2014-12-16 08:53:50.601 [DEBUG][REST]    Param value: <Null>

2014-12-16 08:53:50.601 [DEBUG][REST]    Param is extent: false

2014-12-16 08:53:50.602 [DEBUG][REST]    Param extent: 0

2014-12-16 08:53:50.602 [DEBUG][REST]    Param has Before Image: false

2014-12-16 08:53:50.602 [DEBUG][REST] Param name: ttReportOptions

2014-12-16 08:53:50.602 [DEBUG][REST]    Param type: 15

2014-12-16 08:53:50.602 [DEBUG][REST]    Param ordinal: 5

2014-12-16 08:53:50.602 [DEBUG][REST]    Param mode: 1

2014-12-16 08:53:50.602 [DEBUG][REST]    Param value: <Null>

2014-12-16 08:53:50.602 [DEBUG][REST]    Param is extent: false

2014-12-16 08:53:50.602 [DEBUG][REST]    Param extent: 0

2014-12-16 08:53:50.602 [DEBUG][REST]    Param has Before Image: false

This tells me that the JSON I'm providing is incorrect (or I'm providing it incorrectly). I've double checked and the JSON is valid JSON, and when parsed the structure looks like I would expect. I'm at a bit of a loss as to where to go from here.

Thanks

Posted by knavneet on 16-Dec-2014 06:08

So, the REST Adapter receives null for both dsFormdata and ttReportOptions.
 
Since you have mapped these parameters together in an HTTP body under node names “dsFormdata” and “ttReportOptions”, your JSON input must be wrapped inside a “request” node.
 
Something like this:
===
{ “request” : {
                             “dsFormdata”:
                                                           {
                                                              “dsFormdata”: { …}
                                                              }
                     }
}
 
And
{ “request” : {
                             “ttReportOptions”:
                                                           {
                                                              “ttReportOptions”: { …}
                                                              }
                     }
}
====
I have had experience get NULL in REST Adapter because I missed creating the JSON payload wrapped inside a “request” node. Can you check if that is the case with you too.
 
 
[collapse]
From: RWEBSTER [mailto:bounce-stigdarkstar@community.progress.com]
Sent: Tuesday, December 16, 2014 2:37 PM
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] Mapping multiple Datasets/temp-tables to one REST call
 
Reply by RWEBSTER

Hi knavneet,

Yes the error I'm seeing is in the appserver logs.

The REST logs show that the parameters are being passed across as null:

2014-12-16 08:53:50.601 [DEBUG][REST] Param name: dsformdata

2014-12-16 08:53:50.601 [DEBUG][REST]    Param type: 36

2014-12-16 08:53:50.601 [DEBUG][REST]    Param ordinal: 4

2014-12-16 08:53:50.601 [DEBUG][REST]    Param mode: 1

2014-12-16 08:53:50.601 [DEBUG][REST]    Param value: <Null>

2014-12-16 08:53:50.601 [DEBUG][REST]    Param is extent: false

2014-12-16 08:53:50.602 [DEBUG][REST]    Param extent: 0

2014-12-16 08:53:50.602 [DEBUG][REST]    Param has Before Image: false

2014-12-16 08:53:50.602 [DEBUG][REST] Param name: ttReportOptions

2014-12-16 08:53:50.602 [DEBUG][REST]    Param type: 15

2014-12-16 08:53:50.602 [DEBUG][REST]    Param ordinal: 5

2014-12-16 08:53:50.602 [DEBUG][REST]    Param mode: 1

2014-12-16 08:53:50.602 [DEBUG][REST]    Param value: <Null>

2014-12-16 08:53:50.602 [DEBUG][REST]    Param is extent: false

2014-12-16 08:53:50.602 [DEBUG][REST]    Param extent: 0

2014-12-16 08:53:50.602 [DEBUG][REST]    Param has Before Image: false

This tells me that the JSON I'm providing is incorrect (or I'm providing it incorrectly). I've double checked and the JSON is valid JSON, and when parsed the structure looks like I would expect. I'm at a bit of a loss as to where to go from here.

Thanks

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by RWEBSTER on 16-Dec-2014 06:19

Excellent, this is exactly the issue.

Many thanks!  

This thread is closed