下面更新
是否有人为 Magento SOAP v1 API 提供了适当的 XML 示例来执行以下操作?
client.call(session_token,'sales_order.list', {'filters':{'order_id':{'eq':12}}})
这是一个不适合我的 python suds 调用示例。实际上,任何过滤 sales_order.list、catalog_product.list 或 customer.list 的示例 XML 都可以。我已经为 XMLRPC 版本工作了,但是使用 python 的 SUDS 和 SOAP v1 API,无论过滤器是什么,我都会得到整个列表未过滤作为响应。下面是 XML 当前的样子:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="urn:Magento" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns4:call>
<sessionId xsi:type="ns2:string">6634e1bd1004557677222fd81e809884</sessionId>
<resourcePath xsi:type="ns2:string">sales_order.list</resourcePath>
<args xsi:type="ns0:args">
<filters xsi:type="ns2:filters">
<order_id xsi:type="ns2:order_id">
<eq xsi:type="ns2:string">7</eq>
</order_id>
</filters>
</args>
</ns4:call>
</ns1:Body>
当然,我已经在上面尝试了一百万种其他变体。我只是想知道我的调用是否正确以及我的架构是否错误,或者肥皂服务器是否不稳定,或者是什么。因此,如果有人有一些经过验证的正确 XML 来尝试模拟,那将有很大帮助。
谢谢!
更新:
根据到目前为止我收到的第一个答案,我实际上已经尝试过这种格式的过滤器。正如我们所知,Magento API 的文档是多种多样的、相互矛盾的和不完整的。这是 XML:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="urn:Magento" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns4:call>
<sessionId xsi:type="ns2:string">93c7aaab38adaab5db732b211e5b</sessionId>
<resourcePath xsi:type="ns2:string">sales_order.list</resourcePath>
<args xsi:type="ns0:args">
<filter xsi:type="ns2:filter">
<value xsi:type="ns2:string">123</value>
<key xsi:type="ns2:string">order_id</key>
</filter>
</args>
</ns4:call>
</ns1:Body>
</SOAP-ENV:Envelope>
或者可能:
<ns1:Body>
<ns4:call>
<sessionId xsi:type="ns2:string">93c74cb7ef0baaaaab5db732b211e5b</sessionId>
<resourcePath xsi:type="ns2:string">sales_order.list</resourcePath>
<args xsi:type="ns0:args">
<filter xsi:type="ns2:filter">
<value xsi:type="ns2:value">
<value xsi:type="ns2:string">123</value>
<key xsi:type="ns2:string">eq</key>
</value>
<key xsi:type="ns2:string">order_id</key>
</filter>
</args>
</ns4:call>
</ns1:Body>
</SOAP-ENV:Envelope>
看起来像这样:
{'filter':[{'key':'order_id','value':{'key':'eq','value':'123'}}]}
在蟒蛇。
那些仍然返回所有订单(最终......)。所以,正如我所提到的,如果有人真的可以给我一些 XML 来模拟,它可能会更有用。明天我可能会通过 Magento 源来解决我自己的问题。