开发者

How to call .Net Web Services in Android Application Using Eclipse

开发者 https://www.devze.com 2023-03-25 18:50 出处:网络
Am new in Android Application how to call .Net WebServices in Android am implementing my code is please check

Am new in Android Application how to call .Net WebServices in Android am implementing my code is please check

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
     tv = (TextView)findViewBy开发者_StackOverflow社区Id(R.id.textView1);
    call();
}
public void call()
{
    try {

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

        request.addProperty("hello", "world");

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet=true;
        envelope.setOutputSoapObject(request);

        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        androidHttpTransport.debug=true;

        androidHttpTransport.call(SOAP_ACTION, envelope);

      // SoapPrimitive sp=(SoapPrimitive)envelope.getResponse();

     Object result = (Object)envelope.getResponse();

        tv.setText(result.toString());
    }
    catch (Exception e) 
    {
        tv.setText(e.getMessage());

    }
}

But am getting Error Delimiter missing,also operation timeout and anyone please help me how to debug Android application using Eclipse

Thanks @Lakshmi


You cannot perform any network operations on the UI thread or your Android will generate an ANR Error Dialog. Place your network code inside an AsyncTask to avoid and ANR error.

Note without seeing the logcat output I can not be sure this is the error you are having.

0

精彩评论

暂无评论...
验证码 换一张
取 消