通过ksoap调用webservice一直报java.lang.ClassCastException: org.ksoap2.SoapFault错,网上也找了些,最后才发现自己参数写错了,跟服务器对应不起来,记录下!
其中rpc.addproperty("account",account);写成了rpc.addproperty("accout",account);pc.addProperty("account", account);
public void loginService(String account,String password,String bundleNo)
{
try
{
SoapObject rpc = new SoapObject(NAMESPACE, METHOD_NAME);
rpc.addProperty("account", account);
rpc.addProperty("password", password);
rpc.addProperty("bundleNo", bundleNo);
HttpTransportSE ht = new HttpTransportSE(ENDPOINT);
ht.debug = true;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.bodyOut = rpc;
envelope.dotNet = true;
envelope.setOutputSoapObject(rpc);
ht.call(SOAP_ACTION, envelope);
SoapObject result = (SoapObject) envelope.bodyIn;
if (result != null)
{
Log.e("TAG", "get webservice succeed");
}
else
{
Log.e("TAG", "get webservice failed");
}
// getData(detail);
}
catch (Exception e)
{
e.printStackTrace();
}
}
va.lang.ClassCastException: org.ksoap2.SoapFault
public void loginService(String account,String password,String bundleNo)
{
try
{
SoapObject rpc = new SoapObject(NAMESPACE, METHOD_NAME);
rpc.addProperty("account", account);
rpc.addProperty("password", password);
rpc.addProperty("bundleNo", bundleNo);
HttpTransportSE ht = new HttpTransportSE(ENDPOINT);
ht.debug = true;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.bodyOut = rpc;
envelope.dotNet = true;
envelope.setOutputSoapObject(rpc);
ht.call(SOAP_ACTION, envelope);
SoapObject result = (SoapObject) envelope.bodyIn;
if (result != null)
{
Log.e("TAG", "get webservice succeed");
}
else
{
Log.e("TAG", "get webservice failed");
}
// getData(detail);
}
catch (Exception e)
{
e.printStackTrace();
}
}