That's because you are attempting to do a network call within your UI
thread.  This should help you:
http://developer.android.com/resources/articles/painless-threading.html

On Fri, May 6, 2011 at 7:19 AM, mDroid <manojgodara1...@gmail.com> wrote:

> Hey All,
>
> I want to call a .net web service from android using kshop2 But I get
> a Error SocketException:Activity time out
> Please Help Me....
> My code.
>
>
>
>
>        final String SOAP_ACTION = "http://tempuri.org/Add";;
>        private static final String METHOD_NAME = "Add";
>
>        private static final String NAMESPACE = "http://tempuri.org/";;
>        private static final String URL = "
> http://192.168.1.120:2089/WebSite4/
> WebService.asmx";
>        TextView tv;
>
>        @Override
>        public void onCreate(Bundle savedInstanceState) {
>            super.onCreate(savedInstanceState);
>            setContentView(R.layout.main);
>            tv=(TextView)findViewById(R.id.text1);
>
>            SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
>            PropertyInfo pi = new PropertyInfo();
>        pi.setName("a");
>        pi.setValue(8);
>        pi.setType(int.class);
>        Request.addProperty(pi);
>
>        PropertyInfo pi2 = new PropertyInfo();
>        pi2.setName("b");
>        pi2.setValue(36);
>        pi2.setType(int.class);
>        Request.addProperty(pi2);
>
>
>            SoapSerializationEnvelope envelope = new
> SoapSerializationEnvelope(SoapEnvelope.VER11);
>        envelope.dotNet = true;
>        envelope.setOutputSoapObject(Request);
>        @SuppressWarnings("deprecation")
>             AndroidHttpTransport androidHttpTransport = new
> AndroidHttpTransport(URL);
>
>            try
>        {
>                //tv.setText("Hello Try1...!");
>            androidHttpTransport.call(SOAP_ACTION, envelope);
>            //tv.setText("Hello Try2...!");
>            SoapObject response = (SoapObject)envelope.getResponse();
>          //  tv.setText("Hello Try3...!");
>            int result =
> Integer.parseInt(response.getProperty(0).toString());
>
>            //tv.setText("Hello Try4...!");
>        }
>        catch(Exception E)
>        {
>                tv.setText("ERROR:"    + E.getClass().getName() + ":" +
> E.getMessage());
>           // tv.setText("Hello Catch...!");
>        }
>
>
>
>
>        }
> }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
~ Jeremiah:9:23-24
Android 2D MMORPG: http://solrpg.com/,
http://www.youtube.com/user/revoltingx

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to