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

时间:2015-01-09 11:08:57

标签: xml magento wsdl

我确实有一个看起来像这样的wsdl,我无法改变:

<?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>

我想对complexType salesOrderEntity做一个扩展,我发现在某些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>

但对于我而言,我确实得到了&#34; some_field&#34;元素但不能获得salesOrderEntity complexType的所有元素。

1 个答案:

答案 0 :(得分:1)

看起来我确实发现了它。声明声明:

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>

对不起,这个橡皮鸭调试:x