WSDL复杂类型定义

时间:2018-08-04 08:15:53

标签: c# wsdl magento-1.9

使用c#尝试使用SOAP调用自定义magento服务。

WSDL服务看起来像这样

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
    name="Magento" targetNamespace="urn:Magento">
  <types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
      <!--<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />-->
      <complexType name="FixedArray">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]"/>
          </restriction>
        </complexContent>
      </complexType>
      <complexType name="item">
        <all>
          <element name="key" type="xsd:string"/>
          <element name="value" type="xsd:anyType"/>
        </all>
      </complexType>
    </schema>
  </types>
  <message name="call">
    <part name="sessionId" type="xsd:string" />
    <part name="resourcePath" type="xsd:string" />
    <part name="args" type="xsd:anyType" />
  </message>
  <message name="callResponse">
    <part name="callReturn" type="xsd:anyType" />
  </message>

但是我正试图发出如下所示的请求

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Body>
    <ns1:call>
      <sessionId xsi:type="xsd:string">xxxxxxxxxx</sessionId>
      <resourcePath xsi:type="xsd:string">product_stock.update</resourcePath>
      <args SOAP-ENC:arrayType="xsd:ur-type[2]" xsi:type="SOAP-ENC:Array">
        <item xsi:type="xsd:int">8395</item>
        <item xsi:type="ns2:Map">
          <item>
            <key xsi:type="xsd:string">qty</key>
            <value xsi:type="xsd:int">5</value>
          </item>
          <item>
            <key xsi:type="xsd:string">warehouses</key>
            <value xsi:type="ns2:Map">
              <item>
                <key xsi:type="xsd:string">main</key>
                <value xsi:type="xsd:int">4</value>
              </item>
              <item>
                <key xsi:type="xsd:string">hamilton</key>
                <value xsi:type="xsd:int">1</value>
              </item>
            </value>
          </item>
        </item>
      </args>
    </ns1:call>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我怀疑我将需要解决complexType结构,有关如何实现的任何想法?

欢呼

0 个答案:

没有答案