请求Http获取https

时间:2012-04-28 11:50:00

标签: android asp.net http httpclient

我的公司正在使用基于asp.net的服务,当有某个http get请求时,它会“填充”。 URL如下所示:

https://www.server.tld/service/dostuff.ashx?user=user&pass=pass&command=some+command

我正在尝试在Android中实现一个调用URL的方法。该命令还返回我可能需要获取的xml响应。

目前,我正在处理来自另一个stackoverflow问题的代码,但我似乎无法让它工作:

HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(httpGetUrl);
HttpResponse response;
try {
    response = httpclient.execute(httpget);
    HttpEntity entity = response.getEntity();
    if (entity != null) {
        InputStream instream = entity.getContent();
        String result = convertStreamToString(instream);
        instream.close();
        }
    } catch (Exception e) {}

// convertStreamToString method

我的问题是,对于https连接或与asp交互有什么特殊要求吗?也许我应该为此使用功能更强大的网络客户端?

0 个答案:

没有答案
相关问题