Search code examples
androidweb-servicessoapksoap2

Web Service Issue


I am using Soap WEb service but I am facing one problem like this soap:Server' faultstring: 'Server was unable to process request. ---> There is no row at position 0.' faultactor: 'null

My Code is

public class GetData extends Activity {
    private static final String SOAP_ACTION="http://xxx.mobi/GetMobileContentMetaData";
    private static final String METHOD_NAME="GetMobileContentMetaData";
    private static final String NAMESPACE ="http://xxx.mobi/";
    private static final String URL = "http://webservices.xxx.mobi/MobileLMSServices.asmx";
    SoapObject request;
    Button submit;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.getdata);   
        submit=(Button)findViewById(R.id.submit);
        submit.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                request = new SoapObject(NAMESPACE, METHOD_NAME);
                request.addProperty("SiteURL","http://heaklthcare.xxx.mobi/");
                request.addProperty("ContentID","62b90739-57b9-47cc-884a-8be2ef265304");
                request.addProperty("UserID",809);
                request.addProperty("DelivoryMode",2);
                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                envelope.dotNet = true;
                SoapObject result = null;
                envelope.setOutputSoapObject(request);
                AndroidHttpTransport sab = new AndroidHttpTransport(URL);
                sab.debug = true;
                try {
                    sab.call(SOAP_ACTION, envelope);
                    if (envelope.getResponse() != null) 
                    {
                        result = (SoapObject) envelope.bodyIn;
                        for (int i1 = 0; i1 < 1; i1++) {
                            Object property = result.getProperty(i1);
                            if (property instanceof SoapObject) {
                                SoapObject countryObj = (SoapObject) property;
                                Log.d("country" ,"object"+countryObj);
                            }
                        }
                    }
                }catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
}

Solution

  • Should be an error returned by the server. If you can, call the web method from .net (or if you have a localhost copy of the webservice, input parameters in the browser) .

    I struggled with this error this morning, then I did a small (5 lines) .net app to call the web method. then i got a clearer error message. Also turned out my java code had no problems the whole time.