2015-01-09 59 views
0

我有一個WSDL這樣看,這是我無法改變:是否可以在這個wsdl中擴展這個complexType?

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

,我想提出一個擴展複雜類型salesOrderEntity,我看到一些WSDL(I got the reference from here),這是可能的。

現在我很困惑,如果它是可能的,如何延長這個特定的複雜類型

我的嘗試:

<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」元素,但不會獲得complexType的所有元素。

回答

1

看起來像我發現它。該聲明指出:

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

所以,你必須擴展基本複雜類型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