端点方法更改顺序的参数

Arguments to Endpoints method change order

我正在将 Google App Engine 与 Cloud Endpoints 一起用于一个简单的 Android 应用程序。在后端,我有以下 API 方法,部署到 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); }

问题是,当我从 Android 客户端调用该方法时,参数以相反的顺序传递给该方法:我在客户端作为第一个参数传递的字符串是服务器后端的组 ID,反之亦然。

任何帮助将不胜感激,谢谢!

您可以在此处阅读 [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/