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
Sorry to be of no help but I ran into the same Issue - My request consist of one object which I try to parse but it always results to null - I already tried SoapSerializer.XmlSerializer and SoapSerializer.DataContractSerializer but both didn't work.
What I noticed in my WSDL was that SoapCore seems to expect only a single parameter of my object instead of the previously required multiple parameters. I thus tried to add [MessageContract(IsWrapped = false)] to my Data-Class but without success.
In my case problem was in DataMember description.
I've added "Order" in DataMember description.
[DataMember(Name="name",IsRequired=true,Order=2)]
and sent soap with attributes in direct order.
and one more thing. In interface method definition name of input parameter have to be the same as name of contract.
I am adding SoapCore as below in Program.cs using .Net 8 API project
`var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSoapCore();
builder.Services.TryAddScoped<IAddressValidationSOAP, AddressValidationSOAPService>();
var app = builder.Build();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
// Configure the HTTP request pipeline.
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
// SOAP endpoint
_ = endpoints.UseSoapEndpoint("/AddressValidation.svc", new SoapEncoderOptions(), SoapSerializer.DataContractSerializer);
});
app.MapControllers();
app.Run();
`
But in my service AddressValidationSOAPService.cs, request model SOAPValidationRequest is coming as null, please suggest.
public async Task<SOAPAddressResponseDto> IsValidAddressV2Async(SOAPValidationRequest request)
I am using DataMember attributes and (xmlns:soap) property also matches with the model namespaces.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://www.myapps.com/HISERV/AddressValidation/SOAP">
`[DataContract(Namespace = "https://www.myapps.com/HISERV/AddressValidation/SOAP", Name = "VldnRqs1")]
public class SOAPValidationRequest
{
[DataMember(IsRequired = true, Name = "AppId")]
[XmlElement(ElementName = "AppId")]
public required string ApplicationId { get; set; }
}`
The text was updated successfully, but these errors were encountered: