magento 是否可以在此wsdl中扩展此complexType?

ttcibm8c  于 2022-11-12  发布在  其他
关注(0)|答案(1)|浏览(89)

我有一个WDL,看起来像这样,我不能改变:

<?xml version="1.0" encoding="UTF-8"?>
<definitions 
  xmlns:typens="urn:{{var wsdl.name}}" 
  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="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}"
>
    <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="salesOrderEntity">
                <all>
                    <element 
                      name="increment_id" 
                      type="xsd:string" 
                      minOccurs="0"
                    />
                    <!-- lot more elements come here -->
                </all>
            </complexType>
        </schema>
    </types>
</definitions>

我想对complexTypesalesOrderEntity进行扩展,我看到在一些WSDL(I got the reference from here)中这是可能的。
现在我很困惑,如果它是可能的,以及如何扩展这个特定的complexType
我尝试过:

<complexType name="salesOrderCustomEntity">
    <complexContent>
        <extension base="salesOrderEntity">
            <sequence>
                <element name="some_field" type="xsd:string" minOccurs="0"/>
            </sequence>
        </extension>
    </complexContent>
</complexType>

<complexType name="salesOrderCustomEntity">
    <complexContent>
        <extension base="salesOrderEntity">
            <all>
                <element name="some_field" type="xsd:string" minOccurs="0"/>
            </all>
        </extension>
    </complexContent>
</complexType>

但是,对于这两种情况,我都得到了some_field元素,但没有得到salesOrderEntitycomplexType的所有元素。

h7appiyu

h7appiyu1#

看来我找到了。声明上说:

xmlns:typens="urn:{{var wsdl.name}}"

因此,您必须扩展基本complexType typens:salesOrderEntity,而不仅仅是salesOrderEntity

<complexType name="salesOrderCustomEntity">
    <complexContent>
        <extension base="typens:salesOrderEntity">
            <all>
                <element name="some_field" type="xsd:string" minOccurs="0"/>
            </all>
        </extension>
    </complexContent>
</complexType>

相关问题