0

“响应不包含内容类型”??

在这里,我正在我的应用程序中建立一个连接以获取 XML,例如:

     try {

        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(uri1);

        if(list!=null)
        {
        UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(list);

        httpPost.setEntity(formEntity);
        }
         URI uri=httpPost.getURI();
        HttpResponse httpResponse = httpClient.execute(httpPost);



        StringBuffer sb = new StringBuffer("");
        String line = "";
        String NL = System.getProperty("line.separator");
        while ((line = in.readLine()) != null) {
              sb.append(line + NL);
        }
        in.close();

        result = sb.toString();


}
    catch(UnsupportedEncodingException e)
    {
        String err = (e.getMessage()==null)?"Cant connect to server":e.getMessage();
        Log.e("Network Error:",err); 
    }
    catch (MalformedURLException e) {
        String err = (e.getMessage()==null)?"Malformed Exception":e.getMessage();
        Log.e("Malformed Exception:",err); 

     } 
     catch(Exception ex)
     {
         Log.i("Exception,ex", ex.getMessage());
         String err = (ex.getMessage()==null)?"NetworkConnectionException":ex.getMessage();
         Log.e("NetworkConnectionException:",err); 
     }
    finally {
        if (in != null) {
            try {
                    in.close();
             } catch (Exception ex) {
                 String err = (ex.getMessage()==null)?"Excepion":ex.getMessage();
                 Log.e("Exception:",err); 
            }
        }

     }

    return result;

我在这里使用的 URL 是一个带有 RSS 源的博客 URL

并且作为响应,错误是:“响应不包含内容类型”或“内容已被使用”

我已经尝试了一切但仍然没有成功..请帮助

[已编辑]:获取 XML 的正常 URL 工作正常,但是这个博客 URL 给了我这个错误

4

0 回答 0