Android应用程序中的新功能如何在Android中调用.Net WebServices实现 我的代码请检查
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView)findViewById(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());
}
}
但是我错过了Error Delimiter,也没有操作超时,有人请帮助我如何使用Eclipse调试Android应用程序
由于 @Lakshmi
答案 0 :(得分:0)
您无法在UI线程上执行任何网络操作,否则您的Android将生成ANR错误对话框。将您的网络代码放在AsyncTask内以避免和ANR错误。
注意看不到logcat输出我不能确定这是你遇到的错误。