Использование SoapCore для работы с SOAP в моем веб-сервисе. У меня есть этот простой код ниже, и я ожидаю увидеть DerivedClass, определенный в WSDL. Но я этого не вижу. Что мне делать?
using SoapCore;
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();
var app = builder.Build();
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints => {
endpoints.UseSoapEndpoint("/Testing",
new SoapEncoderOptions(), SoapSerializer.XmlSerializer);
});
app.MapControllers();
app.Run();
}
}
public class Testing : ITesting
{
private IWebHostEnvironment Environment;
public Testing(IWebHostEnvironment _environment)
{
Environment = _environment;
}
public BaseClass Test(BaseClass someObj)
{
throw new NotImplementedException();
}
}
[ServiceContract(Namespace = "http://example.org/")]
public interface ITesting
{
[OperationContract]
public BaseClass Test(BaseClass someObj);
}
[Serializable]
public class DerivedClass : BaseClass
{
[XmlElement]
public string DerivedProp { get; set; }
}
[Serializable]
[XmlInclude(typeof(DerivedClass))]
public class BaseClass
{
[XmlElement]
public string BaseProp { get; set; }
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... g-soapcore