Fredrik Widerberg
Fredrik Widerberg

Reputation: 3108

Android Restlet HTTPS

When trying to get some data on my android client from my webservice (running on app-engine) with this code

ClientResource cr = new ClientResource("https://myapp.appspot.com/restlet/service/");
IServiceResource res = cr.wrap(IServiceResource.class);
m_Services = res.getServices();

I get this error:

05-20 08:30:15.406: ERROR/AndroidRuntime(31767): Caused by: Communication Error (1001) - Could not change the mode after the initial handshake has begun.

i have the org.restlet.ext.ssl.jar for the https-support and i am using this line to add the client

Engine.getInstance().getRegisteredClients().add(new HttpsClientHelper(null));

this is the closest i have come to getting https:// calls to work since i moved up to restlet 2.1m4 (moved because i was in need of entityBuffering..)

Any ideas? Any other information i need to share?

Upvotes: 5

Views: 2265

Answers (2)

Fredrik Widerberg
Fredrik Widerberg

Reputation: 3108

Got it working. Changed HttpClient to org.restlet.ext.net.

On Android, you are told to do this to change the client

Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));

However nothing changes by doing so, instead, i had success with

Engine.getInstance().getRegisteredClients().clear();
Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));

This solves the issu(be sure to have org.restlet.ext.ssl in your build path aswell). This also solves other issues such as the "Internal Connector Error (1002) - The calling thread timed out while waiting for a response to unblock it."

Upvotes: 3

salman khan
salman khan

Reputation:

I had worked with web service using ksoap2, u can try using ksoap2 by downloading the jar and including in ur project.

Upvotes: 0

Related Questions