subhankar1 / gtm-oauth2

Automatically exported from code.google.com/p/gtm-oauth2
0 stars 0 forks source link

JSON format issue for POJO objects as @ApiMethod parameters #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Google Endpoint that takes a POJO parameter
2. Generate the client proxies for Objective-C using the provided tool
3. Call the service method by creating the Api parameter object generated and 
calling the service method
4. The object properties will be NULL at the server for the incoming POJO

What is the expected output? What do you see instead?

Expect the values put into the Obj-C client proxy version of the POJO.

The Google Endpoint project has 3 clients: Android, Javascript (Web) and iOS.  
By comparing the body POST data of the working client calls with those of the 
iOS/gtm client, I was able to find the issue.

The JSON being sent to the API for the POJO parameter differs in that it is 
nested below a top level object "resource:"... aka. kBodyObjectParamKey

So what works for the param:
{
    someProp:"some value";
}
is sent as
{
    resource: {
          someProp:"some value";
    }
}
and the server side POJO has null values.

What version of the product are you using? On what operating system?
2.x on Mac.  Should not be a factor.

Please provide any additional information below.
I was able to isolate the issue and modify the code in GTLService so that it 
would place the JSON body under the "params" directly, without the nesting 
below "resource:", and no surprise, it started working just like the other 
clients.  There may be something going on deeper that I am missing, or an 
option I missed, but I don't see it in the code so far.  Going to do more 
testing, but any insight would be helpful.

Original issue reported on code.google.com by s...@hignett.org on 28 Jan 2014 at 4:17