2012-08-28 30 views
6

Samsung galaxy tab'da SOAP yöntemini test ettim ve iyi çalışıyor.Android ICS SOAP Yöntemi Çalışmıyor?

aynı kod Android dondurma sandviç üzerinde test edilmiş ve çalışmıyor. Bu HTTP/1.1 200 OK kodu 200

gibi

Aşağıda

Benim kodudur, ben baskılı Bu kodda

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);    
      } 

httpResponse.getStatusLine(). toString() baskılı değer ancak satır değeri null.

Teşekkürler. ..

cevap

0

bu deneyin,

StrictMode.ThreadPolicy politikası = new StrictMode.ThreadPolicy.Builder() permitAll() inşa(); StrictMode.setThreadPolicy (policy);

+0

Bu kodu projemde kullanmam gerekiyor ... ??? – Jeeva123

+0

Ağ ile ilgili işlevleri çağırmadan önce. Ana sınıfın beyanı altında kullanılması daha iyidir. – chain