Search code examples
javaandroidksoap

Pass parameter to a webservice using ksoap2?


I have a simple web service method with a parameter like follows

public String fetchOrderInfo(int g){
...

}

I want to pass a value to int g from an Android program using ksoap2. I have used some thing like this but this doesn't work

...
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);  
    PropertyInfo oId = new PropertyInfo();
    oId.flags=3;
    oId.type=PropertyInfo.INTEGER_CLASS;
    request.addProperty(oId,3);
...

How can I pass a value to int g ?? (Severer is Tomcat7) Thanks!


Solution

  • Try this:

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    request.addProperty("g", 3);
    ...