2012-11-25 62 views
0

GAE remote API for java:在App Engine應用客戶端GAE遠程API:RemoteApiInstaller安裝總是失敗

RemoteApiInsideAppEngineExample(String username, String password) 
     throws IOException { 
     // Authenticating with username and password is slow, so we'll do it 
     // once during construction and then store the credentials for reuse. 
     this.options = new RemoteApiOptions() 
      .server("your_target_app_id.appspot.com", 443) 
      .credentials(username, password); 
     RemoteApiInstaller installer = new RemoteApiInstaller(); 
     installer.install(options); 
     try { 
      // Update the options with reusable credentials so we can skip 
      // authentication on subsequent calls. 
      options.reuseCredentials(username, installer.serializeCredentials()); 
     } finally { 
      installer.uninstall(); 
     } 
    } 

配置遠程API在我的測試中它總是拋出異常:

java.lang.IllegalArgumentException: charset may not be null or empty 
    at com.google.appengine.repackaged.org.apache.commons.httpclient.util.EncodingUtil.getString(Unknown Source) 
    at com.google.appengine.repackaged.org.apache.commons.httpclient.util.EncodingUtil.getString(Unknown Source) 
    at com.google.appengine.tools.remoteapi.AppEngineClient$Response.getBodyAsString(AppEngineClient.java:138) 
    at com.google.appengine.tools.remoteapi.RemoteApiInstaller.getAppIdFromServer(RemoteApiInstaller.java:318) 
    at com.google.appengine.tools.remoteapi.RemoteApiInstaller.loginImpl(RemoteApiInstaller.java:278) 
    at com.google.appengine.tools.remoteapi.RemoteApiInstaller.login(RemoteApiInstaller.java:239) 
    at com.google.appengine.tools.remoteapi.RemoteApiInstaller.install(RemoteApiInstaller.java:106) 

.....

我確定用戶名和密碼是admin,我使用GAE 1.7,聯合登錄,高複製數據存儲。

任何想法? 謝謝。

回答

0

更換「your_target_app_id」我想我找到了答案,我使用聯合登錄,目前GAE遠程API不支持聯合登錄---如此糟糕,我花了很多時間進行調試。

0

該代碼正在處理我。你只需要確保你通過的applicationID