Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android POST has empty response

Tags:

android

I'm sending a post request to http://www.pgu.donland.ru/php/Login.php using HttpClient and want to get response like this:

<?xml version="1.0" encoding="utf-8"?><resp status="1" uD="John" UID="2" e=""/>

but unfortunately I keep getting:

<?xml version="1.0" encoding="utf-8"?> <resp status="1" uD="" UID="" e=""/>

What is happening here?

I'm using a custom class with HttpClient client field in it and in my constructor I'm using these settings:

SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme("http", PlainSocketFactory
                                    .getSocketFactory(), 80));
    schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(),
                                    443));

    HttpParams params = new BasicHttpParams();
    params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30);
    params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE,
                                    new ConnPerRouteBean(30));
    params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
    params.setParameter("http.socket.timeout", timeout * 1000);
    params.setParameter("http.connection.timeout", timeout * 1000);
    // params.setParameter("http.connection-manager.timeout", new
    // Long(timeout * 1000));
    params.setParameter("http.protocol.head-body-timeout", timeout * 1000);
    HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);

    ClientConnectionManager cm = new SingleClientConnManager(params,
                                    schemeRegistry);
    this.client = new DefaultHttpClient(cm, params);

Thanks for any help you can provide.

like image 309
Valeriy Avatar asked Nov 04 '22 09:11

Valeriy


1 Answers

a problem is on the server side. Check Login.php code.

like image 195
validcat Avatar answered Nov 11 '22 10:11

validcat