Arguments to Endpoints method change order

101 views Asked by At

I am using Google App Engine with Cloud Endpoints for a simple Android application. In the backend I have the following API method, deployed to GAE:

@ApiMethod(name = "getGroupInfo", path = "groups")
public GroupInfo getGroupInfo(@Named("session") String sessionString, @Named("groupID") String groupID)
                                                        throws ForbiddenException
{
    Logger.getAnonymousLogger().warning("Session string is: " + sessionString);
    Logger.getAnonymousLogger().warning("GroupID is: " + groupID); }

The problem is that when I call the method from the Android client, arguments are passed in reverse order to the method: the string I pass as the first argument in client is group ID in server backend, and the other way around.

Any help would be appreciated, thank you!

1

There are 1 answers

3
Layo On BEST ANSWER

AS you can read here [1]:

Method parameters in the generated client library are in alphabetical order, regardless of the original order in the backend method. As a result, you should be careful when editing your methods, especially if there are several parameters of the same type. The compiler will not be able to catch parameter-ordering errors for you.

[1] https://cloud.google.com/solutions/mobile/google-cloud-endpoints-for-android/