android中的KSOAP请求
我的SOAP请求格式如下:android中的KSOAP请求,android,ksoap2,Android,Ksoap2,我的SOAP请求格式如下: <authentication> <LoginID>string</LoginID> <Password>string</Password> </authentication> <Id>int</Id> <Str>string</Str> SoapObject r
<authentication>
<LoginID>string</LoginID>
<Password>string</Password>
</authentication>
<Id>int</Id>
<Str>string</Str>
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo usrid =new PropertyInfo();
usrid.setName("LoginID");
usrid.setValue(userid);
usrid.setType(String.class);
request.addProperty(usrid);
//
PropertyInfo pass =new PropertyInfo();
pass.setName("Password");
pass.setValue(password);
pass.setType(String.class);
request.addProperty(pass);
PropertyInfo rote =new PropertyInfo();
rote.setName("Id");
rote.setValue(4114616);
rote.setType(int.class);
request.addProperty(rote);
//
PropertyInfo dte =new PropertyInfo();
dte.setName("Str");
dte.setValue(date);
dte.setType(String.class);
request.addProperty(dte);
这是我设置的正确方式吗?因为我收到了错误:
SoapFault - faultcode: 'soap:Server'
faultstring: 'System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.ArgumentNullException: String reference not set to an
instance of a String.
任何人都可以帮助我。请尝试以下代码片段创建您的soap请求:
String YOUR_LOGIN_ID = "Your login id";
String YOUR_PASSWORD = "Your password";
int YOUR_ID = 1;
String YOUR_STR = "Your str value";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapObject authentication = new SoapObject(NAMESPACE, "authentication");
authentication.addProperty("LoginID", YOUR_LOGIN_ID);
authentication.addProperty("Password", YOUR_PASSWORD);
request.addProperty("authentication", authentication);
request.addProperty("Id", YOUR_ID);
request.addProperty("Str", YOUR_STR);
请尝试以下代码段来创建soap请求:
String YOUR_LOGIN_ID = "Your login id";
String YOUR_PASSWORD = "Your password";
int YOUR_ID = 1;
String YOUR_STR = "Your str value";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapObject authentication = new SoapObject(NAMESPACE, "authentication");
authentication.addProperty("LoginID", YOUR_LOGIN_ID);
authentication.addProperty("Password", YOUR_PASSWORD);
request.addProperty("authentication", authentication);
request.addProperty("Id", YOUR_ID);
request.addProperty("Str", YOUR_STR);
嗨,首先硬编码变量的值并查看响应。嗨,我也试过了,它显示了相同的错误。我的代码中的输入设置过程是否正确。可能是服务器出现了问题。我如何才能知道这是服务器问题。转到托管您的web服务的服务器,打开web服务的url,并尝试从浏览器调用web服务。我转到该url,因为只有SOAP请求和响应格式,我如何调用webservices.ur web服务在哪个平台上Hi,首先硬编码变量的值并查看响应。嗨,我也试过了,它显示了相同的错误。我的代码中的输入设置过程是否正确。可能是服务器出现了问题。我如何才能知道这是服务器问题。转到托管您的web服务的服务器,打开web服务的url,并尝试从浏览器调用web服务。我转到该url,因为只有SOAP请求和响应格式存在,所以我如何调用webservices.ur web服务是在哪个平台上的我感谢JPriest..我通过添加代码解决了SOAP错误..但我现在收到errorj ava.lang.RuntimeException:无法序列化:(该字符串)…你能帮我吗?嗨,谢谢你,我已经通过添加你的代码解决了SOAP错误…但是我现在收到了错误J ava.lang.RuntimeException:无法序列化:(该字符串)…你能帮我吗。