当前位置: 代码迷 >> Android >> java.lang.ClassCastException: org.ksoap2.SoapFault,该怎么解决
  详细解决方案

java.lang.ClassCastException: org.ksoap2.SoapFault,该怎么解决

热度:31   发布时间:2016-05-01 11:49:36.0
java.lang.ClassCastException: org.ksoap2.SoapFault
- 在服务器上有一Webservice  地址:http://117.40.139.43:5000/BitcareMobileService/MobileRegister.asmx?op=GetHosInfoAll
- 然后我想获取里面的数据。
用这个方法连接服务器上的Webservice
public String[] GetHosInfoAll(String SOAP_ACTION,String methodName,String MethodDataResult,String HospitalID)throws Exception{
String[][] data = {{"HospitalID",HospitalID}};
return GetArray(SOAP_ACTION,methodName,MethodDataResult,data);
}
然后再用这个方法输出获取到的字符串
public void testGetHosInfoAll() throws Exception{
GetWebService getWebService = new GetWebService();
String[] value = getWebService.GetHosInfoAll("http://tempuri.org/GetHosInfoAll", "GetHosInfoAll", "GetHosInfoAllResult", "07910001");
Log.i(TAG,"testGetHosInfoAll:"+new Integer(value.length).toString());
Log.i(TAG,"testGetHosInfoAll:"+value[0]+value[1]+value[2]);
}
- 但是,却报了java.lang.ClassCastException: org.ksoap2.SoapFault这个错。

- 提示这里:SoapObject result = (SoapObject) envelope.bodyIn;有问题。
- 希望各位专家能为小弟指点一二……谢谢!

------解决方案--------------------
SoapObject result = (SoapObject) envelope.bodyIn;有问题。

把(SoapObjecdt)改成Object就好了
  相关解决方案