Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace SoapCore.Tests.Wsdl.Services;

public class ComplexTypeWithSystemObject
{
public object SystemObject { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.ServiceModel;

namespace SoapCore.Tests.Wsdl.Services
{
[ServiceContract]
public interface IComplexTypeWithSystemObjectService
{
[OperationContract]
ComplexTypeWithSystemObject Test();
}

public class ComplexTypeWithSystemObjectService : IComplexTypeWithSystemObjectService
{
public ComplexTypeWithSystemObject Test() => throw new NotImplementedException();
}
}
19 changes: 19 additions & 0 deletions src/SoapCore.Tests/Wsdl/WsdlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,25 @@ public async Task CheckComplexGenericTypeWithMultipleArgumentsWsdl(SoapSerialize
Assert.AreEqual($"tns:{genericTypeName}Of{genericTypeArgumentName}{genericTypeArgumentName}", typeName);
}

[DataTestMethod]
[DataRow(SoapSerializer.XmlSerializer)]
public async Task CheckComplexTypeWithSystemObjectWsdl(SoapSerializer soapSerializer)
{
var wsdl = await GetWsdlFromMetaBodyWriter<ComplexTypeWithSystemObjectService>(soapSerializer);
Trace.TraceInformation(wsdl);
Assert.IsNotNull(wsdl);

var root = XElement.Parse(wsdl);

var systemObjectElement = GetElements(root, _xmlSchema + "element")
.SingleOrDefault(a => a.Attribute("name")?.Value.Equals(nameof(ComplexTypeWithSystemObject.SystemObject)) == true);

Assert.IsNotNull(systemObjectElement);

var typeAttribute = systemObjectElement.Attribute("type");
Assert.IsNull(typeAttribute);
}

[TestMethod]
public void CheckSchemeOverride()
{
Expand Down
5 changes: 5 additions & 0 deletions src/SoapCore/Meta/MetaBodyWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,11 @@ private void AddSchemaType(XmlDictionaryWriter writer, TypeToBuild toBuild, stri
_complexTypeToBuild.Enqueue(newTypeToBuild);
}
}
else if (type == typeof(object))
{
writer.WriteAttributeString("name", name);
WriteQualification(writer, isUnqualified);
}
else if (toBuild.IsAnonumous)
{
if (string.IsNullOrEmpty(name))
Expand Down
Loading