来自服务器阵列的Android KSoap2响应为空

来自服务器阵列的Android KSoap2响应为空,android,arrays,post,response,ksoap2,Android,Arrays,Post,Response,Ksoap2,我已经搜索了很多,但是没有找到任何帮助,所以我希望有人能对这件事有所帮助 我想使用KSoap发送一个数组,我的操作如下: 首先,我像这样构造soap对象: SoapObject request = new SoapObject(GENERICNAMESPACE, SOAP_METHOD_NAME); PropertyInfo attr = new PropertyInfo(); attr.name = "patientLogin"; attr.type = Pr

我已经搜索了很多,但是没有找到任何帮助,所以我希望有人能对这件事有所帮助

我想使用KSoap发送一个数组,我的操作如下:

首先,我像这样构造soap对象:

SoapObject request = new SoapObject(GENERICNAMESPACE, SOAP_METHOD_NAME);

PropertyInfo attr = new PropertyInfo();
        attr.name = "patientLogin";
        attr.type = PropertyInfo.STRING_CLASS;
        attr.namespace = GENERICNAMESPACE;
        attr.setValue(patientId);
        request.addProperty(attr);

        //could be patientPassword
        attr = new PropertyInfo();
        attr.name = "passwd";
        attr.type = PropertyInfo.STRING_CLASS;
        attr.namespace = GENERICNAMESPACE;
        attr.setValue(patientPassword);
        request.addProperty(attr);

        Vector vectorOfIDsRead = new Vector();
        vectorOfIDsRead.addElement(idsRead);

        attr = new PropertyInfo();
        attr.name = "IDsRead";
        attr.type = PropertyInfo.STRING_CLASS;
        attr.namespace = GENERICNAMESPACE;
        attr.setValue(vectorOfIDsRead);
        request.addProperty(attr);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER10);
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(GENERICURL);
        androidHttpTransport.debug = true;
        try {
            androidHttpTransport.call(GENERICSOAP_ACTION_URL+"feedbackRead", envelope);

            SoapPrimitive resultsRequestSOAP = (SoapPrimitive) envelope
                    .getResponse();

            //log request
            Log.e("SendFeedbackRead", "/////////////////////RequestDump////////////////////");
            Log.e("SendFeedbackRead", androidHttpTransport.requestDump.toString());     
            Log.e("SendFeedbackRead", "/////////////////////////////////////////");

            //log request
            Log.e("SendFeedbackRead", "///////////////////ResponseDump/////////////////");
            Log.e("SendFeedbackRead", androidHttpTransport.responseDump.toString());        
            Log.e("SendFeedbackRead", "/////////////////////////////////////////");

            Log.e("FeedbackRead",
                    "FeedbackRead : " + resultsRequestSOAP.toString());

            return resultsRequestSOAP.toString();
        } catch (Exception e) {
            Log.e("FeedbackRead", "SENDFEEDBACKREAD : " + e);
            return e.getMessage();
        }
请求转储显示我正在发送:

<v:Envelope xmlns:i="http://www.w3.org/1999/XMLSchema-instance" xmlns:d="http://www.w3.org/1999/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"><v:Header />
<v:Body>
<n0:feedbackRead id="o0" c:root="1" xmlns:n0="http://testing.starburst.com/GenericWS">
<n0:patientLogin i:type="d:string">patient1</n0:patientLogin>
<n0:passwd i:type="d:string">pat1</n0:passwd>
<n0:IDsRead i:type="c:Array" c:arrayType="d:anyType[1]"><item i:type="d:string">1234test</item></n0:IDsRead></n0:feedbackRead>
</v:Body>
</v:Envelope>

病人1
第1部分
1234测试
但是我得到的答复是列表是空的

反馈读取,清空提交的ID列表

它不是因为它有一个值

谁能给我指一下正确的方向吗


谢谢

我认为你的错误在这里:

Vector vectorOfIDsRead = new Vector();
vectorOfIDsRead.addElement(idsRead);
attr = new PropertyInfo();
attr.name = "IDsRead";
attr.type = PropertyInfo.STRING_CLASS;
attr.namespace = GENERICNAMESPACE;
attr.setValue(vectorOfIDsRead);
request.addProperty(attr);
您将
vectorOfIDsRead
声明为
Vector
,但将类型作为
STRING\u类
。 它将是:

attr.setType(vectorOfIDsRead.getClass());
然后:

... create the envelope ...
envelope.addMapping(NAMESPACE, "IDsRead", new Vector().getClass());
希望能有帮助。还可以看看这个:


编辑:不管怎样,你能把你的SOAP方法名称的方法签名放进去吗?

谢谢你的输入。我试图改变你在我的代码中所做的差异,但这没有帮助,然后我按照教程进行。同样,没有结果。方法名为SOAP\u method\u name=“feedbackRead”。为什么会发生此错误?对我来说,向量显然不是空的。服务器没有看到这一点的原因是什么?响应已更改,以显示服务器的id列表:04-03 19:22:17.082:E/SendFeedbackRead(18129):方法签名指“feedbackRead”方法的参数数量和类型。(对不起我的英语)。我不知道传递数组的其他方法。