Skip to content

Base class XmlElement catch all property takes precendece over derived class concrete property. #5508

@LunicLynx

Description

@LunicLynx

With this wsdl:

<xs:complexType name="GetItemResponseType">
	...
	<xs:complexContent>
		<xs:extension base="ns:AbstractResponseType">
			<xs:sequence>
				<xs:element name="Item" type="ns:ItemType" minOccurs="0">
					...
				</xs:element>
			</xs:sequence>
		</xs:extension>
	</xs:complexContent>
</xs:complexType>
<xs:complexType name="AbstractResponseType" abstract="true">
	...
	<xs:sequence>
		...
		<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
	</xs:sequence>
</xs:complexType>

Which generates this:

[System.Xml.Serialization.XmlIncludeAttribute(typeof(GetItemResponseType))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:ebay:apis:eBLBaseComponents")]
public abstract partial class AbstractResponseType
{
    ///....

    /// <remarks/>
    [System.Xml.Serialization.XmlAnyElementAttribute(Order = 15)]
    public System.Xml.XmlElement[] Any
    {
        get
        {
            return this.anyField;
        }
        set
        {
            this.anyField = value;
        }
    }
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:ebay:apis:eBLBaseComponents")]
public partial class GetItemResponseType : AbstractResponseType
{
    // ...
    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(Order=0)]
    public ItemType Item
    {
        get
        {
            return this.itemField;
        }
        set
        {
            this.itemField = value;
        }
    }
}

When making a call an receiving a GetItemResponseType instance. Any is set with data that should be in Item. Changing the Order of the XmlElementAttribute does not effect the outcome, only solution is removing Any or moving it to GetResponseType.

Am I doing something wrong?

This is happening with the ebay trading api.
https://developer.ebay.com/webservices/latest/eBaySvc.wsdl

Metadata

Metadata

Assignees

Labels

toolingAn issues related to any tool shipped from this repo.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions