Вопрос

I'm using KSOAP2 3.0.0 with WSDL and trying to call a function called "getAllPklNoSort" from a web service.

Now i'm trying to call the function using android. FYI, i have several other functions in web service, the other works well while this "getAllPklSort" don't.

Another weird thing is, this "getAllPklSort" need 3 input parameters that is "email", "page" and "itemPerPage" and these 3 parameters works fine when called using NuSOAP client.

These code always return an XMLPullParserException and i can't figure out where did i gone wrong here.

Here's the code, any help is appreciated.

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();
    }
Это было полезно?

Решение

Solved, traced the error using

httpTransport.debug = true;

before call, then add this to catch :

System.out.println("Dump : "+httpTransport.responseDump);

The dump message will guide to error cause

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top