HttpTransportSE对象se.call(null,envelope);不能执行,导致activity直接stop
class MyButtonListener implements OnClickListener{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//调用方法
int num1 = 1;
int num2 = 2;
String wsdlUrl = "http://10.3.9.1:8080/TestPort/doAddPort";
String webMethod = "Add";
String nameSpace = "http://test.com/";
String soapAction = nameSpace+webMethod;
SoapObject request = new SoapObject(nameSpace,webMethod);
request.addProperty("a", num1);
request.addProperty("b", num2);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
HttpTransportSE se = new HttpTransportSE(wsdlUrl);
try {
se.call(soapAction,envelope);
System.out.println("你好 手机话费了快速点击封id是否");
if(envelope.getResponse()!= null){
Object result = envelope.getResponse();
Toast.makeText(MainActivity.this, "结果为:"+result, 2).show();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
se.call(soapAction,envelope);里面写null或者soapAction都输不出“你好 手机话费了快速点击封id是否”