2012-08-28 8 views
6

のSamsung GalaxyタブでSOAPメソッドをテストして正常に動作しています。Android ICS SOAPメソッドが機能していませんか?

同じコード私はでテストしました。Androidのアイスクリームサンドイッチは動作していません。以下

IはhttpResponse.getStatusLine()のtoString()この HTTP/1.1 200 OKコード200

プリント値を印刷し、このコードで

HttpPost httppost = new HttpPost("xxxxxx");   
      httppost.setHeader("Content-type", "text/xml; charset=utf-8"); 
      httppost.setHeader("SOAPAction", SoapAction); 

      StringEntity se1 = new StringEntity(env,HTTP.UTF_8); 
      se1.setContentType("text/xml"); 
      se1.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "text/xml; charset=utf-8")); 
      httppost.setEntity(se1); 

      HttpClient httpclient = new DefaultHttpClient(); 
      BasicHttpResponse httpResponse = (BasicHttpResponse) httpclient.execute(httppost); 

      System.out.println("res------"+httpResponse.getStatusLine().toString()+" code "+httpResponse.getStatusLine().getStatusCode()); 

      //Checking response 
      if(httpResponse!=null){ 
       inputStream = httpResponse.getEntity().getContent(); 


       BufferedReader r = new BufferedReader(new InputStreamReader(inputStream)); 
       StringBuilder total = new StringBuilder(); 
       String line=""; 
       try { 
        while ((line = r.readLine()) != null) { 
         total.append(line); 
        } 
       } catch (IOException e) { 
        // TODO Auto-generated catch block 
        e.printStackTrace(); 
       } 
       System.out.println("line----"+line);    
      } 

、私のコードであります行の値はnullになります。

ありがとうございました。 。。

答えて

0

これを試してみて、

StrictMode.ThreadPolicy政策=新しいStrictMode.ThreadPolicy.Builder()permitAll()の構築(); StrictMode.setThreadPolicy(policy);

+0

私のプロジェクトでこのコードを使うべきですか???? – Jeeva123

+0

ネットワーク関連の関数を呼び出す前に。メインクラスの宣言の下で使う方が良い。 – chain

関連する問題