Reputation: 351
I am creating a mobile application for Android which interfaces with an Azure .NET backend (or at least it should). I can create a service object and get a table just fine with this code (with the proper values inserted, obviously):
MobileSerivceClient mClient = new MobileServiceClient(
"https://myApp.azure-mobile.net/",
"myAppKey ",
this
);
MobileServiceTable myMobileServiceTable = mClient.getTable(MyClass.class);
The results are non-null and no exceptions are thrown. However, when I try to execute this code:
myTable.insert(item, new TableOperationCallback<MyClass>() {
@Override
public void onCompleted(MyClass entity, Exception exception, ServiceFilterResponse response) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this).setMessage("Success!");
AlertDialog dialog = builder.create();
if(exception == null)
{
dialog.show();
}
else
{
builder.setMessage("Exception: " + exception.getMessage());
exception.printStackTrace();
dialog = builder.create();
dialog.show();
}
}
});
I receive an error from the server. When inspecting the exception returned in the ServiceFilterResponse object, it seems that the error is caused by a 404 - Not Found response, and the exception returned is of type MobileServiceException. But this doesn't make sense to me, since it seems as though I've already connected to my mobile service successfully. Is it, for some reason, not connecting to my SQL tables that I've connected with the mobile service? And does anyone know where in the "stack", if you will, this error is occuring? I can't figure out for the life of me what's causing the problem.
Thanks!
Upvotes: 0
Views: 2236
Reputation: 2188
We've been playing with the azure mobile services SDK here and this might shed some light. We got error 404 as well in the MobileServiceException but when we print it, we get "Table name xyz does not exist". Did you create a table named "MyClass" in your database? Also, make sure you have objects in MyClass that match the databases columns you have for the "MyClass" table.
Hope that helps.
Upvotes: 2
Reputation: 3092
What happens if you hit your controller using the help page? Note that you can use the help page when hosted in Azure -- just use the master key as the password when prompted in your browser, the username doesn't matter.
Upvotes: 0