Error while calling web service in android 3.0 and above
<p>I run following web service, it run perfect in android 2.2 but generate error in android 3.0 and above, I have tested in 3.0 as well as 4.0 emulator, also shows error in 4.0 device</p>

<pre><code>URL mUrl = new URL("http://www.bmtqs.com.au/DepreciationCalculatorService.svc/basic");
URLConnection conn = mUrl.openConnection();
conn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
conn.addRequestProperty("SOAPAction","http://tempuri.org/IDepreciationCalculatorService/Calculate");
conn.setDoOutput(true);
System.out.println("before");
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
    System.out.println("after");
</code></pre>

<p>it generate error in on line </p>

<pre><code>OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
</code></pre>

<p>Error is about null pointer exception in android 3.0 and above but there is no error in android 2.2</p>

<p>logcate shows</p>

<pre><code>04-19 15:18:49.696: E/AndroidRuntime(550): FATAL EXCEPTION: main
04-19 15:18:49.696: E/AndroidRuntime(550): java.lang.NullPointerException
04-19 15:18:49.696: E/AndroidRuntime(550):  at com.app.ip.bmt.TaxCalActivity$8.handleMessage(TaxCalActivity.java:917)
04-19 15:18:49.696: E/AndroidRuntime(550):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 15:18:49.696: E/AndroidRuntime(550):  at android.os.Looper.loop(Looper.java:137)
04-19 15:18:49.696: E/AndroidRuntime(550):  at android.app.ActivityThread.main(ActivityThread.java:4340)
04-19 15:18:49.696: E/AndroidRuntime(550):  at java.lang.reflect.Method.invokeNative(Native Method)
04-19 15:18:49.696: E/AndroidRuntime(550):  at java.lang.reflect.Method.invoke(Method.java:511)
04-19 15:18:49.696: E/AndroidRuntime(550):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-19 15:18:49.696: E/AndroidRuntime(550):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-19 15:18:49.696: E/AndroidRuntime(550):  at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>Please help me to come out.</p>
