更新如下
有没有人可以为magentosoapv1api提供一个合适的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的sud和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>
当然,我已经尝试了上百万种其他的变体。我只是想知道我的调用是否正确,我有一个坏的模式,或者soap服务器是否不稳定,或者什么。因此,如果任何人有一些被证明是正确的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'}}]}
在Python中。
而且他们仍然会(最终)返回所有订单。所以,正如我所提到的,如果有人真的能给我一些XML来模拟,它可能会更有用。明天我可能会从Magento源代码中找到根并解决我自己的问题。
您为筛选器编写了错误的格式数组输入。
我想,如果这是php的解决方案的话。
你可以用python来平衡它。
好吧,我不得不拒绝(并学习)我的PHP,但我有答案,如果有任何其他可怜的sap出现,并想使用sud(或一般python)与Magento。
此xml:
由以下php创建:
当然,在Magento的协议的特定实现方面,也有一些与SOAP相关的编码问题——看起来它是设计用来与phpsoap客户机一起工作的,但实际上不是与其他任何东西一起工作的。但这个XML转储确实让我可以四处闲逛,把SUDS连接从地上取下来——如果你有兴趣的话,给我发个消息。哦,还有给“阿兰斯托姆”的帽子。
我知道这个问题是关于API的v1,但是如果您使用v2,您可以这样做:
菲律宾比索:
Python等价物:
相关问题 更多 >
编程相关推荐