Android ksoap2将对象添加到对象中

时间:2011-02-03 12:32:14

标签: java android xml ksoap2

我遇到问题需要从我的网络服务获得回复。我有这样的事情:

<AuthenticateUser xmlns="http://whatever">
  <request>
    <Username>string</Username>
    <Password>string</Password>
    <Partner>string</Partner>
  </request>
 </AuthenticateUser>

我不知道如何将这些树参数添加到对象<request>

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:3)

private static final String SOAP_ACTION = "http://whatever/AuthenticateUser";
private static final String METHOD_NAME = "AuthenticateUser";
private static final String NAMESPACE = "http://whatever";
private static final String URL = "www.blablabla.com/test?WSDL";

SoapObject authenticateUser = new SoapObject(NAMESPACE, METHOD_NAME);
SoapObject request = new SoapObject(NAMESPACE, "request");
request.addProperty("Username","VALUE");
request.addProperty("Password","VALUE");
request.addProperty("Partner","VALUE");
authenticateUser.addSoapObject(request);

我希望有所帮助!