dotnet / dotnet/wcf

dotnet-svcutil cannot handle recursively nested XSD structures

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

Description

Here is an excerpt from our WSDL definition. The structure oel_CmisExtensionTypeList is recursively nested:

```












```
To generate the WCF class this command was used:
`dotnet-svcutil http://localhost:17089/wsdl --namespace "*, COI.SOAPConnector" --internal --sync --reference "c:\Program Files\dotnet\sdk\8.0.100\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\System.Collections.dll" --noStdLib --outputFile BflowWSDL.cs --targetFramework "net8.0"
`

The generated class (I also tried dotnet-svcutil 2.1.0, it does not work either) looks like this:
```
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="ObjectService__performTaskActionRequest", WrapperNamespace="http://www.coi.de/bflowsoap", IsWrapped=true)]
internal partial class ObjectService__performTaskActionRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://www.coi.de/bflowsoap", Order=0)]
public string username;

[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://www.coi.de/bflowsoap", Order=3)]
[System.Xml.Serialization.XmlArrayItemAttribute("item")]
public COI.SOAPConnector.COI.SOAPConnector.oel_CmisExtensionType[] extension;
```
The definition of _extension_ contains two errors: Firstly, the namespace COI.SOAPConnector appears twice:
COI.SOAPConnector.COI.SOAPConnector.oel_CmisExtensionType[]
and secondly, the XSD definition contains a reference to oel_CmisExtensionTypeList, not to oel_CmisExtensionType

The svcutil used with .NET6 has generated the correct code here.
Even if the duplicate namespace is corrected manually, the transfer of values in extension.any no longer works.

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.