dotnet / dotnet/wcf

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

Open
#5,508 0 comments 0 reactions 1 assignee Claimed by @imcarolwang View on GitHub
tooling
Dominant language
C#
Stars
1.8k
Forks
576
Avg merge
6d 9h
Merged PRs (30d)
2

Description

With this wsdl:

```xml

...




...



...

...

```

Which generates this:

```csharp
[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
{
///....

///
[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
{
// ...
///
[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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.