Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LunicLynx opened this issue Apr 23, 2024 · 0 comments
Assignees
Labels
tooling An issues related to any tool shipped from this repo.

Comments

@LunicLynx
Copy link

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

@HongGit HongGit added the tooling An issues related to any tool shipped from this repo. label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling An issues related to any tool shipped from this repo.
Projects
None yet
Development

No branches or pull requests

3 participants