【发布时间】:2013-11-05 14:08:30
【问题描述】:
我正在使用带有 WSDL 的 KSOAP2 3.0.0,并尝试从 Web 服务调用名为“getAllPklNoSort”的函数。
现在我正在尝试使用 android 调用该函数。仅供参考,我在 Web 服务中还有其他几个功能,其他功能很好,而这个“getAllPklSort”没有。
另一个奇怪的是,这个“getAllPklSort”需要3个输入参数,即“email”、“page”和“itemPerPage”,而这3个参数在使用NuSOAP客户端调用时可以正常工作。
这些代码总是返回一个 XMLPullParserException,我不知道我在哪里出错了。
这是代码,感谢任何帮助。
private static final String NAMESPACE = "urn:Server";
private static final String URL = "http://10.0.2.2/project/server.php";
private static String SOAP_ACTION = "urn:Server#getAllPklNoSort";
private static String METHOD_NAME = "Functions.getAllPklNoSort";
public void getSoap()
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo pi = new PropertyInfo();
pi.setName("email");
pi.setValue(email);
pi.setType(String.class);
PropertyInfo pi2 = new PropertyInfo();
pi2.setName("page");
pi2.setValue(0);
pi2.setType(Integer.class);
PropertyInfo pi3 = new PropertyInfo();
pi3.setName("itemPerPage");
pi3.setValue(10);
pi3.setType(Integer.class);
request.addProperty(pi);
request.addProperty(pi2);
request.addProperty(pi3);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
try
{
httpTransport.call(SOAP_ACTION, envelope);
}
catch (Exception exception)
{
exception.printStackTrace();
}
【问题讨论】:
标签: android exception ksoap2 xmlpullparser