我已经看过如何在Android上使用Ksoap2的所有可能示例。我能够从相同的代码访问公共可用的SOAP Web服务。但是当我尝试使用我的服务团队编写SOAP服务时,我一直在
“java.IO.exception:HTTP请求失败:HTTPS状态:500” 基本上在HttpTransportSEObj.call(Namespace + methodname,envelope)上调用失败;
我可以从iOS客户端调用相同的服务。
我不知道该怎么做。
是否与命名空间与我的实际网址有什么不同?我不知道。
NameSpace:http://xyz.net/webmethod/mobile, 网址:http://xyz.com/lite/webmethod/mobile.asmx, 方法名称:登录
非常感谢任何帮助。
EDIT1: 我从例外获得了更多信息,这是回复
soap:ServerServer无法处理请求。 --->对象引用未设置为对象的实例。
Edit2:在这里添加调用代码
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("email","xyc.com");
request.addProperty("password","Passw@rd1");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request); //prepare request
HttpTransportSE httpTransport = new HttpTransportSE(URL);
httpTransport.debug = true;
Log.i("bodyout", "" + envelope.bodyOut.toString());
try {
httpTransport.call(SOAP_ACTION, envelope); //send request
SoapObject result=(SoapObject)envelope.getResponse(); //get response
if(result != null)
Log.i("Response"," Service response is " + result);
} catch (Exception e) {
Log.e("SOAP_TEST", "========= Request start =========");
Log.e("SOAP_TEST", httpTransport.requestDump);
Log.e("SOAP_TEST", "========== Request end ==========");
Log.e("SOAP_TEST", "========= Response start ========");
Log.e("SOAP_TEST", httpTransport.responseDump);
Log.e("SOAP_TEST", "========== Response end =========");
Log.e("", "error", e);
}
}