Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Aug 11, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant