我为我的应用程序实现了许多SOAP函数,但现在我遇到了一些问题:
public int generatePost(String sid, int uid, int obj_id, int ref_id, int thr_pk,
String msg, int pos_pk, String title, String date)
{
int pos_pk_new = 0;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
SoapObject soapObject = new SoapObject("urn:ilUserAdministration", "generatePost");
soapObject.addProperty("sid", sid);
soapObject.addProperty("uid", uid);
soapObject.addProperty("obj_id", obj_id);
soapObject.addProperty("ref_id", ref_id);
soapObject.addProperty("thr_pk", thr_pk);
soapObject.addProperty("msg", msg);
soapObject.addProperty("pos_pk", pos_pk);
soapObject.addProperty("title", title);
soapObject.addProperty("date", date);
envelope.setOutputSoapObject(soapObject);
HttpTransportSE transport = new HttpTransportSE(PATH_TO_YOUR_ILIAS_INSTALLATION + "/webservice/soap/server.php");
transport.debug = true;
try
{
transport.call("generatePost", envelope);
pos_pk_new = Integer.parseInt(envelope.getResponse().toString());
return pos_pk_new;
}
catch (IOException e)
{ e.printStackTrace(); }
catch (XmlPullParserException e)
{ e.printStackTrace(); }
return 0;
}
参数如:PATH_TO_YOUR_ILIAS_INSTALLATION,urn:ilUserAdministration等都可以。我有其他功能正常,但这个正在产生这个错误:
org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG (empty) <br>@1:6 in java.io.InputStreamReader@44c45f52)
0
at org.kxml2.io.KXmlParser.exception(Unknown Source)
at org.kxml2.io.KXmlParser.require(Unknown Source)
at org.ksoap2.SoapEnvelope.parse(Unknown Source)
at org.ksoap2.transport.Transport.parseResponse(Unknown Source)
at org.ksoap2.transport.HttpTransportSE.call(Unknown Source)
at de.ilias.SOAPExample.generatePost(SOAPExample.java:1048)
at de.ilias.SOAPExample.main(SOAPExample.java:1473)
php函数generatePost工作正常,因为我在php片段中测试过它。
ksoap库是否有可能添加到soapObject的参数限制?
感谢。
答案 0 :(得分:0)
好的,很好,我只是忘了在我的肥皂功能中添加一个库...有一天试图解决问题,那就是。它已经解决了。