我使用ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar与soap web服务交谈。这适用于运行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,但这不起作用。
非常感谢任何帮助。
由于
大卫
答案 0 :(得分:2)
我目前有同样的问题。我使用ksoap2库版本2.5.7解决了它。希望能帮助到你。它必须是带有接收编码的2.6.5上的错误。