title: Is this Google Endpoints error on the server or client?
body: <p>I've been learning Google Endpoints from the tutorial at <a href="https://developers.google.com/appengine/docs/java/endpoints/" rel="nofollow noreferrer">https://developers.google.com/appengine/docs/java/endpoints/</a>.  I got the Endpoint successfully deployed to Google App Engine and I managed to build a simple iPhone app that calls the Endpoint.  However, my iPhone app gets the following error when it tries to call the Endpoint: </p>
  
  <h2>Error Message</h2>
  
  <p>error   NSError *   domain: @"com.google.GTLJSONRPCErrorDomain" - code: -32099  0x00000001094518a0</p>
  
  <p>_userInfo   __NSDictionaryI *   3 key/value pairs   0x00000001094452b0</p>
  
  <p>[0] (null)  @"error" : @"java.lang.IndexOutOfBoundsException: Index: 0, Size: 0"<br>
  [1] (null)  @"NSLocalizedFailureReason" : @"(java.lang.IndexOutOfBoundsException: Index: 0, Size: 0)"<br>
  [2] (null)  @"GTLStructuredError" : (no summary)    </p>
  
  <h2>iPhone API Caller (in Objective-C running in Xcode Debugger)</h2>
  
  <pre><code>- (IBAction)myButton:(id)sender {
      NSInteger myId;
      if (self.mySwitch.isOn) {
          myId = 0;
      }
      else {
          myId = 1;
      }
      GTLQueryHelloworld *query = [GTLQueryHelloworld queryForGreetingsGetGreetingWithIdentifier:myId];
      [self.helloWorldService executeQuery:query completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) {
          if (!error) {
              [self.myLabel setText:object];
          }
          else {
              [self.myLabel setText:[error description]];  // This line gets called 
          }
      }];
  }
  </code></pre>
  
  <p>I found the same error message reported in <a href="https://stackoverflow.com/questions/19859248/youtube-video-upload-fails-after-100-progress-for-some-users-with-backend-erro">Youtube video upload fails after 100 % progress for some users with Backend Error code:-32099</a> but that pertained to calling YouTube and it was eventually closed as a bug that was fixed.  So I don't think it's related.</p>
  
  <p>I believe the bug is on the client side because I put some logging on the server (Java) and it does not appear to get called:</p>
  
  <pre><code>public class Greetings {
      private static final Logger log = Logger.getLogger(Greetings.class.getName());
  
      public static ArrayList&lt;HelloGreeting&gt; greetings = new ArrayList&lt;HelloGreeting&gt;();
  
      static {
              log.setLevel(Level.INFO);
              greetings.add(new HelloGreeting("hello world!"));
              greetings.add(new HelloGreeting("goodbye world!"));
      }
  
          public HelloGreeting getGreeting(@Named("id") Integer id) {
              log.info("HelloGreeting called with getGreeting");
              log.info("getGreeting id " + id);
              return greetings.get(id);
      }
  </code></pre>
  
  <p>I don't see "HelloGreeting called with getGreeting" in my Google server logs, all I see is the log message indicating that my Endpoint project was successfully deployed:</p>
  
  <p>21:56:45.639 Endpoints: <a href="https://1-war-dot-firstendpointproject.appspot.com/_ah/api/helloworld@v1" rel="nofollow noreferrer">https://1-war-dot-firstendpointproject.appspot.com/_ah/api/helloworld@v1</a> Saved</p>
  
  <p>I've also confirmed I can successfully test the helloworld.greetings.getGreeting API from the deployed API explorer for my project:</p>
  
  <p><a href="https://1-war-dot-firstendpointproject.appspot.com/_ah/api/explorer" rel="nofollow noreferrer">https://1-war-dot-firstendpointproject.appspot.com/_ah/api/explorer</a></p>
  
  <p>When I call the API from the Explorer it generates a log message:</p>
  
  <p>24.130.150.54 - - [19/Jun/2014:21:17:45 -0700] "POST /_ah/spi/com.google.appengine.samples.helloendpoints.Greetings.getGreeting HTTP/1.1" 200 93 "<a href="https://1-war-dot-firstendpointproject.appspot.com/_ah/api/static/proxy.html?jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.htta44JhPmg.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Fz%3Dzcms%2Frs%3DAItRSTPk1CJ1YqUCyb-H-zhkQTjKPZwvbQ" rel="nofollow noreferrer">https://1-war-dot-firstendpointproject.appspot.com/<em>ah/api/static/proxy.html?jsh=m%3B%2F</em>%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.htta44JhPmg.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Fz%3Dzcms%2Frs%3DAItRSTPk1CJ1YqUCyb-H-zhkQTjKPZwvbQ</a>" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "1-war-dot-firstendpointproject.appspot.com" ms=17 cpu_ms=87 cpm_usd=0.000010 instance=00c61b117ce13f56d6eb483511c2c1bcd24241 app_engine_release=1.9.6</p>
  
  <p>It does not generate "HelloGreeting called with getGreeting" but I suspect that is because I have not configured the logger.  At any rate, when my client calls the Endpoint I get no log message at all.  Since the API explorer call at least generates 1 log message, I suspect the problem is on the client.</p>
  
  <p><strong>Questions:</strong></p>
  
  <p>1] Is the error I'm seeing generated on the client or the server side?</p>
  
  <p>2] Do you know what array this error is refering to?</p>
  
  <p>3] What are some techniques for debugging a connection problem like this?</p>
  
  <p>Thanks for your help StackOverflowers!</p>
  
  <p>Michael</p>