什么是使用magento SOAP API的多线程方法的正确方法?

时间:2013-11-28 07:55:57

标签: ios xml web-services magento soap

我已经实现了两种调用magento方法的方法,第一种是http://sudzc.com/类,第二种是http://www.wsdl2code.com/Pages/Home.aspx类。但不能通过任何一种方式获得产品信息。

请检查两对多呼叫方法的请求和响应: -

SUDZC

要求: -

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
  <multiCall>
     <sessionId>b543e92c12944a5512c624a4944423d8</sessionId>
     <calls>(
"catalog_product.info"
    )</calls>
     <options>(
     productId,
     5
    )</options>
  </multiCall>
</soap:Body>
</soap:Envelope>

响应: -

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
  <ns1:multiCallResponse>
     <multiCallReturn SOAP-ENC:arrayType="xsd:ur-type[0]" xsi:type="ns1:FixedArray" />
  </ns1:multiCallResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Wsdl2code(我认为这里有肥皂信封有问题,因为里面没有指定参数,让我知道如何纠正它)

请求: -

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
  <multiCall xmlns="urn:Magento">
     <sessionId>b543e92c12944a5512c624a4944423d8</sessionId>
     <calls>
        <MagentoService>
           <SoapVersion>Default</SoapVersion>
           <AllowAutoRedirect>0</AllowAutoRedirect>
           <EnableDecompression>0</EnableDecompression>
           <UnsafeAuthenticatedConnectionSharing>0</UnsafeAuthenticatedConnectionSharing>
           <UseDefaultCredentials>0</UseDefaultCredentials>
           <PreAuthenticate>0</PreAuthenticate>
           <Url>http://mediaplus.co.za/api/soap/?wsdl/multiCall</Url>
           <Timeout>0</Timeout>
        </MagentoService>
     </calls>
  </multiCall>
 </soap:Body>
</soap:Envelope>

响应: -

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
  <SOAP-ENV:Fault>
     <faultcode>SOAP-ENV:Server</faultcode>
     <faultstring>Cannot use object of type stdClass as array</faultstring>
  </SOAP-ENV:Fault>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

1 个答案:

答案 0 :(得分:2)

经过大量谷歌搜索后,我通过查看this post设法解决了这个问题。 它有一个示例项目。