我正在创建可以使用肥皂客户端(WSDL)连接到 Web 服务的 android 应用程序。现在我想知道是否可以使用 PropertyInfo 创建请求并为其设置多个名称和值。我有此代码以获取有关我的问题的更多信息。
String METHOD_NAME = "callLog";
String NAMESPACE = "http://sasd.logpos.com/appservs/app/customize/qwe/ecq.wsdl/";
String URL = "http://sasd.logpos.com/appservs/app/customize/qwe/ecqsoap.php";
String SOAP_ACTION = "http://sasd.logpos.com/appservs/app/customize/qwe/ecq.wsdl/callLog";
Log.i("myEmpId", myEmpId);
Log.i("myPassword", myPassword);
//create request
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//create param
PropertyInfo paramsEmpId = new PropertyInfo();
paramsEmpId.setName("authuserid");
paramsEmpId.setValue(myEmpId);
paramsEmpId.setType(String.class);
paramsPass.setName("authpassword");
paramsPass.setValue(myPassword);
paramsPass.setType(String.class);
request.addProperty(paramsEmpId, "LOGON");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(URL);
try {
ht.call(SOAP_ACTION, envelope);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
String response = null;
try {
response = envelope.getResponse().toString();
} catch (SoapFault e) {
e.printStackTrace();
}