Android XML解析与二进制base64图像

时间:2015-06-22 09:54:15

标签: android xml web-services

我在.NET Web服务中有一个图像,我有ArrayOfBase64Binary = parent& base64Binary = child个标签。我无法在Android中检索XML文件。我正在使用SOAP Web服务ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar

有人可以帮我检索xml&解析它?

提前致谢。

1 个答案:

答案 0 :(得分:0)

anyType{}显然意味着您从SOAP获得NULL值。 可能是您应该调试Web服务并查看它是否也返回任何值。 或者尝试将SOAP Library更新为ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar

以下是解析数据的方法

SoapObject result = (SoapObject) envelope.bodyIn;
Log.e("result", result.toString());

SoapObject resultOne = (SoapObject) result.getProperty(0);  //Inside the first tag
SoapObject resultTwo = (SoapObject) resultOne.getProperty(0);  //Inside the second tag

Log.e("Count", resultTwo.getPropertyCount()+"");

for (int i = 0; i < resultTwo.getPropertyCount(); i++) {
        SoapObject resultThree = (SoapObject) resultTwo.getProperty(i);
        Log.e(""+i, resultThree.toString());

        String id = resultThree.getProperty("Id").toString();
        String PartName = resultThree.getProperty("Part_Name").toString();
}