问题描述
我在使用ksoap
for android的网络服务无法使用comunicate
时遇到麻烦.想法是接收JSON
作为String,然后对该字符串进行一些解析.我打开了Eclipse Web服务浏览器的Web服务表单,在服务器端一切似乎都工作正常,提供给请求的参数是正确的.
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.
我的错误:
SoapFault - faultcode: 'soapenv:Server' faultstring: '3' faultactor: 'null' detail: org.kxml2.kdom.Node@b75ddd60
SOAP错误代码说这是服务器错误,但是正如我上面所说的,它可以很好地用于Eclipse Web服务浏览器.
SOAP fault codes says that its a server error, but as I said above it works fine form Eclipse web services explorer.
我的代码:
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();
}
我正在android 2.2上工作.
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
推荐答案
最后,我找到了问题的原因.当我应该将"id"作为参数名称传递给标识符"时.
Finally I found the reason for the problem. I was passing "id" as a parameter name when it should have been "identifier".
花了很长时间才能发现问题,可能是因为故障字符串没有太大帮助.我的猜测是faultstring ="3"表示参数编号3有问题.
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.
这篇关于Android Ksoap Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!