如何在android中使用SOAP API获取带有过滤器的magento订单列表?

时间:2015-07-16 08:18:09

标签: magento soap

它总是只在android中返回已完成的订单。

如何在android中编写这个php代码来获取结果

$filters = array(array(
            'filter' => array(
                array(
                    'key' => 'status',
                    'value' => 'pending'
                ))));

发送肥皂客户端

request = new SoapObject(NAMESPACE, "salesOrderList");
request.addProperty("sessionId",sessionId );
request.addProperty("filters", filters);

2 个答案:

答案 0 :(得分:1)

您可以使用android

中的ksoap2-android库执行以下操作
// NAMESPACE - specify your namespace
// sessionId - get by calling the login web service
// SALES_ORDER_LIST - web service to get sales order list

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = false;
envelope.xsd = SoapSerializationEnvelope.XSD;
envelope.enc = SoapSerializationEnvelope.ENC;

SoapObject entity = new SoapObject(NAMESPACE, "associativeEntity");
entity.addProperty("key", "status");
entity.addProperty("value", "processing");

SoapObject filter = new SoapObject(NAMESPACE, "associativeArray");
array.addProperty("associativeEntity", entity);

SoapObject filters = new SoapObject(NAMESPACE, "filters");
filter.addProperty("filter", filters);

SoapObject salesOrderList = new SoapObject(NAMESPACE, "salesOrderList");
requestCart.addProperty("sessionId", sessionId);
requestCart.addProperty("filters", filters);

env.setOutputSoapObject(salesOrderList);
androidHttpTransport.call(SALES_ORDER_LIST, envelope);

result = env.getResponse();
Log.d("List of Products", result.toString());

答案 1 :(得分:0)

使用kso​​ap2-android库对magento soap进行复杂过滤

class func changeLanguageForceFully(currLan : String){
        let langCultureCode: String = currLan
        let defaults = NSUserDefaults.standardUserDefaults()
        defaults.setObject([langCultureCode], forKey: "AppleLanguages")
        defaults.synchronize()
    }