Search code examples
androidksoap2

Android ksoap web service


I am having trouble to comunicate with my web service using ksoap for android. The idea is to receive a JSON as String and then do some parsing on this string. I opened my web service form Eclipse web services explorer and everything seems to be working fine on server side, parameters provided to the request are correct.

My error:

SoapFault - faultcode: 'soapenv:Server' faultstring: '3' faultactor: 'null' detail: org.kxml2.kdom.Node@b75ddd60

SOAP fault codes says that its a server error, but as I said above it works fine form Eclipse web services explorer.

My code:

private static final String method_get_quest_by_id = "getQuestionsById";
private static final String NAMESPACE = "http://surveys.services.backend.capi.ateam";
private static final String retirieveQuestById = NAMESPACE
        + method_get_quest_by_id;
private static String url = "http://ec2-184-73-10-139.compute-1.amazonaws.com:8080/Services/services/SurveyService";

try{
       SoapObject request = new SoapObject(NAMESPACE,method_get_quest_by_id);
       SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
       request.addProperty("userName", userName);
       request.addProperty("password", pass);
       request.addProperty("id", id);
       envelope.setOutputSoapObject(request);
       HttpTransportSE androidHttpTransport = new HttpTransportSE(url);
       androidHttpTransport.call(retirieveQuestById, envelope);
       Object result = envelope.getResponse();
       resultString= result.toString();
   } catch (Exception E) {
       E.printStackTrace();
   }

Im working on android 2.2.

Can someone please help me? I've been stuck on this for a couple of days now... Thank you


Solution

  • Finally I found the reason for the problem. I was passing "id" as a parameter name when it should have been "identifier".

    Took a long time to spot the problem probably because the faultstring was not of much help. My guess is that the faultstring = "3" indicates a problem with parameter number 3.