私は自分のアプリに多くの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スニペットでテストしたので、php関数generatePostは正常に機能しています。
ksoapライブラリにsoapObjectに追加するパラメータの制限がある可能性はありますか?
ありがとう。