dotnet / dotnet/wcf

dotnet-svcutil does not generate attributes from nested attribute groups in WSDL

Open
#5,686 1 comment 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

**Describe the bug**
When using dotnet-svcutil to generate a .NET client for a SOAP service defined by a WSDL that includes nested attributeGroup references, the generated client code does not contain the attributes from the nested attributeGroup. Only attributes from the outer attributeGroup are included, leaving the client incomplete and missing necessary attributes.

**To Reproduce**
Steps to reproduce the behavior:
1. Use the following WSDL to define a simple SOAP service with nested attribute groups:
```xml






















































```
2. Run the following dotnet-svcutil command to generate the client code:
```bash
dotnet-svcutil "simple-service.wsdl" \
--outputFile "SoapService.cs" \
--targetFramework net8.0 -v Debug \
--namespace *,"foo" \
-ser XmlSerializer \
-wr
```
3. Observe that the generated SimpleRequest class does not include Attribute1 and Attribute2 from InnerAttributes. Only AdditionalAttribute from OuterAttributes is generated.
4. Example of generated code:
```csharp
public partial class SimpleRequest
{
private string additionalAttributeField;

[System.Xml.Serialization.XmlAttributeAttribute()]
public string AdditionalAttribute
{
get { return this.additionalAttributeField; }
set { this.additionalAttributeField = value; }
}
}
```

**Expected behaviour**
I expected dotnet-svcutil to generate SimpleRequest with all attributes from both OuterAttributes and the nested InnerAttributes, as defined in the WSDL. Specifically, SimpleRequest should include Attribute1 and Attribute2 in addition to AdditionalAttribute.

**Additional context**
This issue affects applications relying on nested attributeGroup structures, as such grouping is often used in complex XML schemas. The missing attributes result in incomplete client data structures, which leads to issues when interacting with the SOAP service.

**Environment:**
dotnet-svcutil version: 2.1.0
.NET SDK version: net8.0

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.