【发布时间】:2014-09-19 12:43:24
【问题描述】:
我正在使用 ksoap2 Android 库通过 SOAP 调用 Magento api。登录方法(获取 sessionId)工作正常,但调用方法不接受额外的参数。调用方法有三个参数: 调用(sessionId,resourcePath,数组参数)。我要调用的资源路径是 customer.list,其他参数是过滤器(电子邮件)。 Api 文档是here。
Hashtable<String, String> hashtable = new Hashtable<String, String>();
hashtable.put("email", "myemail");
SoapObject request = new SoapObject("urn:Magento", "call");
request.addProperty("resourcePath", "customer.list");
request.addProperty("sessionId", sessionId);
request.addProperty("args", hashtable);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
(new MarshalHashtable()).register(envelope);
envelope.dotNet = false;
envelope.xsd = SoapSerializationEnvelope.XSD;
envelope.enc = SoapSerializationEnvelope.ENC;
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(URL);
transport.debug = true;
transport.call("", envelope);
使用此代码,我成功获取了客户列表,但电子邮件过滤器将不适用。 提前致谢!
【问题讨论】:
-
嗨,我想请你分享答案。我在 android 中的磁 SOAP v1 集成遇到麻烦
-
嗨。我们从 SOAP 切换到 XMLRPC,所以我帮不了你……对不起!
标签: android magento soap ksoap2