Send https request

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Send https request

Postby acidcromaticle » Tue Oct 05, 2010 1:01 pm

I'm trying to make a microsoft communications messenger client for android :D.

Now i'm working at the connection and logon methods, and i have a problem.

I have to send to Communications server a https request with user's username and password and the server will then send back a authenticate response with a uri to use it next to create the session.

The response is in a xml format and i receive the response but with an error :(. I think that i dont send the user and pass corectly through the request, because i had deleted the user and pass and the error is still the same, after that i've tried to run the code without sending the user and pass and i had received the same error.

the error is : <cwaResponses><requestFailed eid="4"/></cwaResponses>

My code is:
Code: Select all
        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(),
        params = new BasicHttpParams();
        params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 1);
                new ConnPerRouteBean(1));
        params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setContentCharset(params, "utf8");

        clientConnectionManager = new ThreadSafeClientConnManager(params,

         context = new BasicHttpContext();
         "<cwaRequest xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns=\"\"><logon><user>domain\\user</user><password>pass</password></logon></cwaRequest>");

        HttpClient client = new DefaultHttpClient(clientConnectionManager,

        HttpGet httpget = new HttpGet("https://ocs-srv.domain:4443/mcx/mcxform/logon.html");

         "<cwaRequest xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns=\"\"><logon><user>domain\\user</user><password>pass</password></logon></cwaRequest>");
        try {

            HttpResponse response = client.execute(httpget);

            String str = EntityUtils.toString(response.getEntity());

            Toast.makeText(Acom.this, "mesaj: " + str, Toast.LENGTH_LONG)

        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            Toast.makeText(Acom.this, "e1: " + e, Toast.LENGTH_LONG).show();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            Toast.makeText(Acom.this, "e2: " + e, Toast.LENGTH_LONG).show();

The big problem is that i dont know how to send the user and pass by the request.
I have searched on google and i'm trying to find how can i make the logon session.

I hope somebody can help me .

Thank you!

EDIT: - now i know what method to use to request the logon infos.. the method is POST, i tried to make the example from this forum with the post request but i get the same error, and the error it tels that i am sending the request in a bad format, i get that error even if i dont put something in the post's entity.

Can anyone help me please? Thank you!
Posts: 2
Joined: Mon Oct 04, 2010 8:15 am


Return to General

Who is online

Users browsing this forum: No registered users and 6 guests