0

我收到这样的肥皂反应......

anyType{ViewList=anyType{View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB5L2; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB5L1; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB4; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB2L2; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB2; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB6; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB6L2; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB7L2; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB7L3; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB7L4; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB8L1; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB8L2; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB8L3; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB8L4; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB8L5; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB9L1; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB9L2; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB9L3; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB10L1; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB10L2; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=dbpdftest2; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDBT1; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=anyType{}; ViewName=pdfDB7L1; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=myView; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=pdfDB5L3; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=anyType{}; ViewName=pdfDM13L1; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=anyType{}; ViewName=pdfDM15L1; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=anyType{}; ViewName=pdfM15; response=anyType{}; visibility=Assigned To; }; View=anyType{ViewList=null; ViewID=1; ViewName=MandS; response=anyType{}; visibility=Assigned To; }; }; ViewID=null; ViewName=null; response=anyType{ResponseStatus=SUCCESS; }; visibility=null; }

我正在尝试从这个请求中得到这个......

try {
            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

            androidHttpTransport.call(SOAP_ACTION, envelope);

            SoapObject result = (SoapObject) envelope.getResponse();

            if (result != null) {
                System.out.println(result);
                //userIsValid = parseResponse(result);
                return result;
            } else {
                Toast.makeText(getApplicationContext(), "No Response",
                        Toast.LENGTH_LONG).show();
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

并像这样解析肥皂对象....

private boolean parseResponse(SoapObject root) {
        // TODO Auto-generated method stub

        for (int i = 0; i < root.getPropertyCount(); i++) {

            Object property = root.getProperty(i);
            if (property instanceof SoapObject) {
                SoapObject category_list = (SoapObject) property;

                if (category_list.hasProperty("ResponseStatus")) {
                    System.out.println(category_list.getProperty("dashboardName").toString());

                //}

            }

        }

        return true;

    }

但是在这里我只得到成功的响应...我想访问那里的所有值,例如 ViewName、view id 等..我该怎么做..

4

2 回答 2

1

尝试解析该肥皂对象并将其存储在向量中。

此代码片段可以帮助您,

public static Vector parsealldetails(SoapObject resultObject) {
    Vector predictionList = new Vector();
    SoapObject resObject = (SoapObject) (resultObject).getProperty(0);

    String[][] HAll = new String[0][2];

    for (int i = 0; i < resObject.getPropertyCount(); i++) {
        HAll = expand(HAll, i + 1, 4);
        int j = 0;

        while (j < 2) {
            j++;
            String str1 = ((SoapObject) resObject.getProperty(i))
                    .getProperty("ID").toString();
            HAll[i][j - 1] = str1;

            j++;
            String str2 = ((SoapObject) resObject.getProperty(i))
                    .getProperty("Name").toString();
            HAll[i][j - 1] = str2;

        }
    }

    predictionList.addElement(HAll);
    return predictionList;
}

如果你使用布尔值,它只会将结果显示为成功或失败

于 2013-09-05T06:31:04.787 回答
0

如果您正在寻找从 KSOAP 返回的 complexType 数组,请查看此处

于 2013-09-05T05:23:34.797 回答