我正在使用下面的代码从响应中获取值,但是我在主线程异常上收到以下错误网络,但是我确定 url、命名空间、方法和肥皂操作是正确的,因为它们在浏览器中工作,我在解析 SoapObject 和 soaSerializationEnvelope 时也遇到错误,我该如何解决这个问题,或者我是否可以有一个简单的例子来解析一个肥皂请求并获得一个非常好的项目的价值
公共无效测试(){
textView = (TextView) findViewById(R.id.textView1);
SoapObject reSoapObject = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope soaSerializationEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
soaSerializationEnvelope.setOutputSoapObject(reSoapObject);
HttpTransportSE httpTransportSE = new HttpTransportSE(URL);
String ip = null;
try {
httpTransportSE.call(SOAP_ACTION, soaSerializationEnvelope);
SoapObject soapObjectResultRoot = (SoapObject) soaSerializationEnvelope.bodyIn;
Log.e(">>>>>>>>>>>>>>>>>>", "Root elemtn body: "
+ soapObjectResultRoot.toString());
SoapObject soapObjectGetProperty = (SoapObject) soapObjectResultRoot.getProperty("return");
ip = soapObjectGetProperty.getProperty("return").toString();
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
textView.setText(" \nIP --> " + ip);
}