导入外部的ksoap2库实现从webservice上接收数据,但是如果webservice不存在,就会返回一个空指针,现在我想捕捉这个异常为什么需要好几分钟才能捕捉的?
代码如下
try{
SoapObject result = (SoapObject) envelope.bodyIn;
detail = (SoapObject)result.getProperty("GetMediInfoByNameResult");
}catch(Exception e){
e.printStackTrace();
System.out.println("联网异常...");
}
就是上面的那个detail,如果webservice连接不上的时候,会返回空值。
期望大家的帮助!
代码如下
try{
SoapObject result = (SoapObject) envelope.bodyIn;
detail = (SoapObject)result.getProperty("GetMediInfoByNameResult");
}catch(Exception e){
e.printStackTrace();
System.out.println("联网异常...");
}
就是上面的那个detail,如果webservice连接不上的时候,会返回空值。
期望大家的帮助!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货