我在以下方法中遇到错误:
public ResultUsers[] getContacts(java.lang.String user_id, java.lang.String offset, java.lang.String limit,
java.lang.String phone_contacts) throws SoapFault {
SoapObject _client = new SoapObject("urn:UserProfile", "GetContacts");
_client.addProperty("user_id", user_id);
_client.addProperty("offset", offset);
_client.addProperty("limit", limit);
_client.addProperty("phone_contacts", phone_contacts);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
HttpTransportSE _ht = new HttpTransportSE(Configuration.getWsUrl()); // line 378
try {
_ht.call("urn:UserProfile#GetContacts", _envelope);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
return ResultUsers.toArray((Vector<SoapObject>) _envelope.getResponse());
}
这是logcat输出:
org.xmlpull.v1.XmlPullParserException: Unexpected token (position:TEXT
Fatal error: Ca...@3:1 in java.io.InputStreamReader@41bab9b0)
at org.kxml2.io.KXmlParser.next(KXmlParser.java)
at org.kxml2.io.KXmlParser.next(KXmlParser.java)
at org.kxml2.io.KXmlParser.nextTag(KXmlParser.java)
at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:127)
at org.ksoap2.transport.Transport.parseResponse(Transport.java:118)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:253)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:116)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:111)
at com.virtulos.virtulosandroid.soap.userprofile.ServerServicePortType.getContacts(ServerServicePortType.java:375)
at com.virtulos.virtulosandroid.model.db.service.ContactService.getContactsFromCloud(ContactService.java:79)
at com.virtulos.virtulosandroid.task.LoadContactsTask.doInBackground(LoadContactsTask.java:58)
at com.virtulos.virtulosandroid.task.LoadContactsTask.doInBackground(LoadContactsTask.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java)
at java.lang.Thread.run(Thread.java)
null
java.lang.NullPointerException
at org.ksoap2.serialization.SoapSerializationEnvelope.getResponse(SoapSerializationEnvelope.java:521)
at com.virtulos.virtulosandroid.soap.userprofile.ServerServicePortType.getContacts(ServerServicePortType.java:387)
at com.virtulos.virtulosandroid.model.db.service.ContactService.getContactsFromCloud(ContactService.java:79)
at com.virtulos.virtulosandroid.task.LoadContactsTask.doInBackground(LoadContactsTask.java:58)
at com.virtulos.virtulosandroid.task.LoadContactsTask.doInBackground(LoadContactsTask.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java)
at java.lang.Thread.run(Thread.java)
我在谷歌上发现的是,在共鸣的开头有3个字符,这通常是android中的解析器所不知道的,这就是它崩溃的原因。但我不知道如何摆脱这些角色,如果这是问题,我如何解决它,因为我需要直接返回结果。任何帮助将非常感激。
答案 0 :(得分:0)
获取WSDL网址: http://abc.xyz/ws/User.wsdl
然后找到服务名称;它可能会在页面的末尾。
例如:
<wsdl:service name="servicename">
<wsdl:port name="userport" binding="tns:usrbinding">
<soap:address
location="http://abc.xyz/soap/ws/ServerWSDL.php" />
</wsdl:port>
</wsdl:service>
该位置是您的主要网址;你必须将标题设置为该位置的网址。一切都完成了。
注意:请勿更改soapAction网址。