简体   繁体   English

Android ksoap网络服务

[英]Android ksoap web service

I am having trouble to comunicate with my web service using ksoap for android. 我有麻烦comunicate用我的web服务ksoap为Android。 The idea is to receive a JSON as String and then do some parsing on this string. 我们的想法是接收一个JSON作为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. 我打开了我的Web服务表单Eclipse Web服务资源管理器,一切似乎在服务器端正常工作,提供给请求的参数是正确的。

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. SOAP故障代码说它是一个服务器错误,但正如我上面所说,它可以很好地运行Eclipse Web服务资源管理器。

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. 我正在研究android 2.2。

Can someone please help me? 有人可以帮帮我吗? I've been stuck on this for a couple of days now... Thank you 我已经被困在这几天了......谢谢

Finally I found the reason for the problem. 最后我找到了问题的原因。 I was passing "id" as a parameter name when it should have been "identifier". 当它应该是“标识符”时,我传递“id”作为参数名称。

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. 我的猜测是,faultstring =“3”表示参数编号为3的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM