Android XMLPullParserException预计START_TAG

时间:2014-07-09 15:05:07

标签: android soap

应用程序使用以下第一个字符串准备一个Envelope:

<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">

在进行调用时,在响应转储中,我看到第一个字符串:

<s:Envelope xmlns:s="https://schemas.xmlsoap.org/soap/envelope/">

注意: https

和系统错误:

expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <{https://schemas.xmlsoap.org/soap/envelope/}s:Envelope>

由于此XMLPullParserHTTPS看起来private static final String METHOD_NAME = "XMLDataGet"; private static final String NAMESPACE = "http://tempuri.org/"; private static final String URL = "https://website.com/_vti_bin/MY.APP/APPService.svc"; final String SOAP_ACTION = "http://tempuri.org/IAPPService/XMLDataGet"; ========================= try { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("entity", "persona"); request.addProperty("last_update_date", "20140101"); request.addProperty("country", "UA"); request.addProperty("user", "someuser"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); Log.i(TAG, "Envelope to String: \n" + String.valueOf(envelope)); Log.i(TAG, "request to String: \n" + String.valueOf(request)); envelope.implicitTypes = true; envelope.setAddAdornments(false); envelope.dotNet = true; envelope.bodyOut = request; envelope.setOutputSoapObject(request); 无法识别XML。

如何更改?

创建信封的代码:

{{1}}

1 个答案:

答案 0 :(得分:0)

我通过捕获InputStream并将https替换为http

来解决这个问题。