我在以下代码中遇到异常
package com.dipl.smpm.smpm;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
import org.ksoap2.transport.HttpTransport;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
public class ConnectHttp extends Activity {
private static final String SOAP_ACTION = "http://tempuri.org/loginDetails";
private static final String METHOD_NAME = "loginDetails";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://localhost:88/EmpService.asmx";
TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv=(TextView)findViewById(R.id.textView11);
SoapObject sobj_requestLogin=new SoapObject(NAMESPACE, METHOD_NAME);
sobj_requestLogin.addProperty("username", "a");
sobj_requestLogin.addProperty("password", "a");
SoapSerializationEnvelope spenve_Login = new SoapSerializationEnvelope(SoapEnvelope.VER11);
spenve_Login.dotNet=true;
spenve_Login.setOutputSoapObject(sobj_requestLogin);
AndroidHttpTransport htrans_login= new AndroidHttpTransport(URL);
try{
Toast.makeText(getApplicationContext(), "1", Toast.LENGTH_SHORT).show();
htrans_login.call(SOAP_ACTION,spenve_Login);
Toast.makeText(getApplicationContext(), "2", Toast.LENGTH_SHORT).show();
SoapPrimitive spprim_login=(SoapPrimitive)spenve_Login.getResponse();
Toast.makeText(getApplicationContext(), "3", Toast.LENGTH_SHORT).show();
tv.setText("result: "+spprim_login+" ");
Toast.makeText(getApplicationContext(), "4", Toast.LENGTH_SHORT).show();
}
catch(Exception e){
Toast.makeText(getApplicationContext(), "Exception", Toast.LENGTH_LONG).show();
}
}
}
我成功地得到了一个吐司'1',但它会在吐司'2'到来之前立即出现'异常'吐司。帮帮我我的错误是什么?我也使用 2.3 ksoap2 2.3 jar 作为用户定义的库。