I got my android+appengine application (endpoint) up and running, everything works fine on my local machine, so I decided to upload my appengine code so that I can try accessing data through the Android application directly on my mobile phone.
When I try to call to my appengine backend, I got 404 error.
On browser if I try to call for http://[myAppID].appspot.com/_ah/spi I get:
Error: HTTP method GET is not supported by this URL
So the main serlvet is responding, what am I doing wrong??
(Permission for Internet granted!)
Thanks in advance!!
here's the code, this is executed inside an AsyncTask:
Builder endpointBuilder = new Myendpoint.Builder(AndroidHttp.newCompatibleTransport(), new JacksonFactory(), new HttpRequestInitializer() {
public void initialize(HttpRequest httpRequest) {
}
});
Myendpoint endpoint = CloudEndpointUtils.updateBuilder(endpointBuilder).build();
try {
MyUsers result = endpoint.searchMyUser(params[0]).execute();
return result.getItems().get(0);
} catch (Exception e) {
e.printStackTrace();
return null;
}
This is the code inside CloudEnpointUtils (obviously LOCAL_ANDROID_RUN is set to false) :
public static <B extends GoogleClient.Builder> B updateBuilder(B builder) {
if (LOCAL_ANDROID_RUN) {
builder.setRootUrl(LOCAL_APP_ENGINE_SERVER_URL + "/_ah/api/");
}
// only enable GZip when connecting to remote server
final boolean enableGZip = builder.getRootUrl().startsWith("https:");
builder.setJsonHttpRequestInitializer(new JsonHttpRequestInitializer() {
public void initialize(JsonHttpRequest jsonHttpRequest) {
jsonHttpRequest.setEnableGZipContent(enableGZip);
}
});
return builder;
}
I add the logcat for error:
10-04 11:40:22.770 W/System.err(13564): com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
10-04 11:40:22.770 W/System.err(13564): Not Found
10-04 11:40:22.775 W/System.err(13564): at com.google.api.client.googleapis.services.GoogleClient.executeUnparsed(GoogleClient.java:279)
10-04 11:40:22.775 W/System.err(13564): at com.google.api.client.http.json.JsonHttpRequest.executeUnparsed(JsonHttpRequest.java:207)
10-04 11:40:22.775 W/System.err(13564): at com.appspot.api.services.myuserendpoint.Myuserendpoint$SearchMyUser.execute(Myuserendpoint.java:702)
10-04 11:40:22.775 W/System.err(13564): at it.my.my.app.core.MyBusinessDelegate$MyUserGetter.doInBackground(MyBusinessDelegate.java:303)
10-04 11:40:22.775 W/System.err(13564): at it.my.my.app.core.MyBusinessDelegate$MyUserGetter.doInBackground(MyBusinessDelegate.java:1)
10-04 11:40:22.780 W/System.err(13564): at android.os.AsyncTask$2.call(AsyncTask.java:264)
10-04 11:40:22.780 W/System.err(13564): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
10-04 11:40:22.780 W/System.err(13564): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
10-04 11:40:22.780 W/System.err(13564): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
10-04 11:40:22.785 W/System.err(13564): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
10-04 11:40:22.785 W/System.err(13564): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
10-04 11:40:22.785 W/System.err(13564): at java.lang.Thread.run(Thread.java:856)
EDIT: AppEngine DeployLog
------------ Deploying frontend ------------
Preparing to deploy:
Created staging directory at: 'C:\Users\XXXXXXXXX\AppData\Local\Temp\appcfg1884750854541661749.tmp'
Scanning for jsp files.
Compiling jsp files.
Scanning files on local disk.
Initiating update.
Cloning 1 static files.
Cloning 66 application files.
Deploying:
Uploading 0 files.
Initializing precompilation...
Deploying new version.
Verifying availability:
Will check again in 1 seconds.
Will check again in 2 seconds.
Will check again in 4 seconds.
Closing update: new version is ready to start serving.
Updating datastore:
Uploading index definitions.
Deployment completed successfully
EDIT2: other infos
I've tried to communicate with a java servlet I've put in appengine war, via browser there's no problem everything is working fine, if I try to ping from command line or try to communicate programmatically I have this error:
"Unable to resolve host "[myappID].appspot.com": No address associated with hostname"
Please anybody help me find a solution
EDIT 3: Good news, I've been able to call my servlet using the appengine address with version that is:
http://[version].[myAppID].appspot.com/myServlet
instead of:
http://[myAppID].appspot.com/myServlet
I don't know why but this way it'works! Still no luck trying to call remote appengine app via endpoint even using version-address trick, hope this help!