我使用 ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar 与肥皂网络服务对话。这在运行 android 4.0.4 的设备上完美运行,返回预期的响应。然而,在我尝试的所有其他设备(2.1、2.2 等)上,它会引发以下异常:
06-13 12:16:34.154: E/Soap(849): unterminated entity ref (position:TEXT �������������`I�...@1:18 in java.io.InputStreamReader@43d66f08)
06-13 12:16:34.154: E/Soap(849): org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT �������������`I�...@1:18 in java.io.InputStreamReader@43d66f08)
活动代码:
private static final String METHOD_NAME = "TopGoalScorers";
private static final String SOAP_ACTION = "http://footballpool.dataaccess.eu/data/TopGoalScorers";
private static final String NAMESPACE = "http://footballpool.dataaccess.eu";
private static final String URL = "http://footballpool.dataaccess.eu/data/info.wso?WSDL";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo propertyInfo = new PropertyInfo();
propertyInfo.setName("iTopN");
propertyInfo.setValue("5");
propertyInfo.setType(int.class);
request.addProperty(propertyInfo);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
httpTransport.debug = true;
try {
httpTransport.call(SOAP_ACTION, envelope);
Log.d("Soap", "Finished Call");
} catch (IOException e) {
Log.e("Soap", e.getMessage(), e);
} catch (XmlPullParserException e) {
Log.e("Soap", e.getMessage(), e);
}
}
任何想法可能是什么问题?我尝试将 dotNet 标志设置为 true,但没有成功。
任何帮助将不胜感激。
谢谢
大卫