You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to this Microsoft page when XmlElement attribute is applied to a collection property the result should be a "flat" sequence. Take this code:
using SoapCore;
using System.Collections.ObjectModel;
using System.ServiceModel;
using System.Xml.Serialization;
internal class Program
{
private static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers().AddXmlSerializerFormatters();
builder.Services.AddSoapCore();
builder.Services.AddScoped<ITesting, Testing>();
var app = builder.Build();
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints => { endpoints.UseSoapEndpoint<ITesting>("/Testing", new SoapEncoderOptions(), SoapSerializer.XmlSerializer); });
app.MapControllers();
app.Run();
}
}
public class Testing : ITesting
{
private IWebHostEnvironment Environment;
public Testing(IWebHostEnvironment _environment)
{
Environment = _environment;
}
public void Test(ExampleClass someObj)
{
throw new NotImplementedException();
}
}
[ServiceContract(Namespace = "http://example.org/")]
public interface ITesting
{
[OperationContract]
public void Test(ExampleClass someObj);
}
[Serializable]
public class ExampleClass
{
[XmlElement]
public Collection<string> ExampleProp { get; set; }
}
In WSDL I should see a simple sequence <xs:element minOccurs="0" maxOccurs="unbounded" name="ExampleProp" type="xsd:string" />, but I see ArrayOfString construct instead.
The text was updated successfully, but these errors were encountered:
According to this Microsoft page when
XmlElement
attribute is applied to a collection property the result should be a "flat" sequence. Take this code:In WSDL I should see a simple sequence
<xs:element minOccurs="0" maxOccurs="unbounded" name="ExampleProp" type="xsd:string" />
, but I seeArrayOfString
construct instead.The text was updated successfully, but these errors were encountered: