我正在使用带有android studio IDE的ksoap库也成功获得了web服务的响应(我从debuging中看到了它)。通常这段代码正在运行;但是,这次给我错误任何帮助,谢谢。
response = (SoapObject) envelope.getResponse(); // works I do got response
for (int i = 0; i < count; i++){ // counting works, it is getting in to for loop
Object property = response.getProperty(i); // error: cannot find local variable 'property',response working but it is not capble to cast it to property.
SoapObject swListSoap = (SoapObject) property;
String SoapName = swListSoap.getProperty(TAG_NAME).toString();
...
}
答案 0 :(得分:0)
问题是将soap对象解析为整数或双(推荐,尽可能使用字符串..)。 例如,如果要通过TAG_NAME =&#34; NAME&#34;解析soap对象属性;不要使用:
<HTML>
<head>
</head>
<body>
<div class = "screenWidth">Header text</div>
<div class = "screenWidth">Paragraph text</div>
<img class = "screenWidth" src = "yourSvg.svg">
<script>
document.getElementsByClassName("screenWidth")[0].width = screen.width;
document.getElementsByClassName("screenWidth")[3].width = screen.width;
document.getElementsByClassName("screenWidth")[2].width = screen.width;
</script>
</body>
</HTML>
使用:
int SoapLineName = Integer.parseInt(soapObject.getProperty(TAG_LINENAME).toString());
我在扫描属性和解析到listview时遇到了麻烦。解决方案使用String ..