Android ICS SOAP method not working?

I tested the SOAP method in the galaxy galaxy tab and it works fine.

The same code that I tested for the Android ice cream sandwich does not work.

Below is my code,

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

In this code, I typed httpResponse.getStatusLine (). toString () printed value similar to this HTTP / 1.1 200 OK code 200

but the string value is null.

thanks.

+6
source share
1 answer

Try it,

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder (). allowAll (). build (); StrictMode.setThreadPolicy (policy);

0
source

Source: https://habr.com/ru/post/923935/


All Articles