Magento 1.7 soap request using filter and/or complex filter -
i trying list of orders magento using filters , complex filter through use of soap. following xml-snippet shows the structure of standard request without parameters set yet.
magento 1.7 soap client using apache cxf there items in database...
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:magento"> <soapenv:header/> <soapenv:body> <urn:salesorderlistrequestparam> <sessionid>?</sessionid> <filters> <!--optional:--> <filter> <!--zero or more repetitions:--> <complexobjectarray> <key>?</key> <value>?</value> </complexobjectarray> </filter> <!--optional:--> <complex_filter> <!--zero or more repetitions:--> <complexobjectarray> <key>?</key> <value> <key>?</key> <value>?</value> </value> </complexobjectarray> </complex_filter> </filters> </urn:salesorderlistrequestparam> </soapenv:body> </soapenv:envelope>
i tried call api using request , 1 filter, this:
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:magento"> <soapenv:header/> <soapenv:body> <urn:salesorderlistrequestparam> <sessionid>02ec011a4deef70a55104d8b229e0d41</sessionid> <filters> <!--optional:--> <filter> <!--zero or more repetitions:--> <complexobjectarray> <key>customer_lastname</key> <value>cook</value> </complexobjectarray> </filter> <!--optional:--> <complex_filter> <!--zero or more repetitions:--> </complex_filter> </filters> </urn:salesorderlistrequestparam> </soapenv:body> </soapenv:envelope>
the response holds data wished, list of orders mr. cook. far good.
now after enjoying great success (;-)) tried next level. in case tried send more criteria aggregate desired data , database.
therefore tried orders created date. following xml shows type of request:
<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <ns2:salesorderlistrequestparam xmlns:ns2="urn:magento"> <sessionid>2b15208c5153189ed7477750c177716c</sessionid> <filters> <complex_filter> <complexobjectarray> <key>created_at</key> <value> <key>from</key> <value>2012-07-06 12:55:51</value> </value> </complexobjectarray> </complex_filter> </filters> </ns2:salesorderlistrequestparam> </soap:body> </soap:envelope>
in fact request creates error in database. here statement created magento:
select `main_table`.*, `billing_o_a`.`firstname`, `billing_o_a`.`lastname`, `billing_o_a`.`telephone`, `billing_o_a`.`postcode`, `shipping_o_a`.`firstname`, `shipping_o_a`.`lastname`, `shipping_o_a`.`telephone`, `shipping_o_a`.`postcode`, `billing_o_a`.`firstname` `billing_firstname`, `billing_o_a`.`lastname` `billing_lastname`, `shipping_o_a`.`firstname` `shipping_firstname`, `shipping_o_a`.`lastname` `shipping_lastname`, concat(billing_o_a.firstname, ' ', billing_o_a.lastname) `billing_name`, concat(shipping_o_a.firstname, " ", shipping_o_a.lastname) `shipping_name` `mage_sales_flat_order` `main_table` left join `mage_sales_flat_order_address` `billing_o_a` on (main_table.entity_id = billing_o_a.parent_id , billing_o_a.address_type = 'billing') left join `mage_sales_flat_order_address` `shipping_o_a` on (main_table.entity_id = shipping_o_a.parent_id , shipping_o_a.address_type = 'shipping') (((from = '')))
obviously makes no sense.. there no column 'from' , send date hiding , why
... (((from = '')))
<complexobjectarray> <key>created_at</key> <value> <key>from</key> <value>2012-07-06 12:55:51</value> </value> <complexobjectarray>
exception 'zend_db_statement_exception' message 'sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'from = '')))' @ line 3' in /home/.../public_dev/lib/zend/db/statement/pdo.php:234
well goes terrible wrong here ...
here example snippet magento page:
<item xsi:type="ns1:complexfilter"> <key xsi:type="xsd:string">protect_code</key> <value xsi:type="ns1:associativeentity"> <key xsi:type="xsd:string">in</key> <value xsi:type="xsd:string">a4ffa8</value> </value> </item>
maybe has clue solve issue!?
thanks in advance...
rather using "from" or "to" - have tried using "gteq" , "lteq" instead? when testing using php works; can't supply upper , lower bound, e.g.,
<complexobjectarray> <item> <key>created_at</key> <value> <key>gteq</key> <value>2012-07-06 12:55:51</value> </value> </item> <item> <key>created_at</key> <value> <key>lteq</key> <value>2013-07-06 12:55:51</value> </value> </item> <complexobjectarray>
Comments
Post a Comment