SoapCore
SoapCore copied to clipboard
Error with Basic Authentication
When using the newest release of the library I am trying to add a service reference to the service however it consistently says that "0 service(s) found at address 'url'"
I have verified it is the correct address as I have monitored that it has hit the middleware (which gets the following error)
fail: SoapCore.SoapEndpointMiddleware[0]
An error occurred processing the message
System.InvalidOperationException: No operation found for specified action: http://schemas.xmlsoap.org/ws/2004/09/transfer/Get
at SoapCore.SoapEndpointMiddleware`1.ProcessMessage(Message requestMessage, SoapMessageEncoder messageEncoder, IAsyncMessageFilter[] asyncMessageFilters, HttpContext httpContext, IServiceProvider serviceProvider)
at SoapCore.SoapEndpointMiddleware`1.ProcessOperation(HttpContext httpContext, IServiceProvider serviceProvider)
I am unsure if this a case that something is missing in the startup of the service or a general issue in the library. I have been able to repeat this problem of 0 services found with a differently implemented use of soapcore upgrading the newest version.
I have looked into this further and can definitively isolate the source is from the UseBasicAuthentication in the startup. My startup is below:
var soapEncoderOptions = new SoapEncoderOptions
{
BindingName = "WsHttpBinding",
MessageVersion = MessageVersion.Soap12WSAddressingAugust2004,
WriteEncoding = Encoding.UTF8,
ReaderQuotas = XmlDictionaryReaderQuotas.Max
};
endpoints.UseSoapEndpoint<ControlCentre>(soapCoreOptions =>
{
soapCoreOptions.EncoderOptions = new[] { soapEncoderOptions };
soapCoreOptions.UseBasicAuthentication = true;
soapCoreOptions.Path = Config.ServiceUrl;
soapCoreOptions.SoapSerializer = SoapSerializer.DataContractSerializer;
soapCoreOptions.CaseInsensitivePath = true;
soapCoreOptions.SoapModelBounder = new ModelValidator();
} );
If I remove the UseBasicAuthentication I am able to add a service reference once again. I am happy making the necessary changes if you can help point me to what those changes might be and where?
https://github.com/DigDes/SoapCore/blob/b6ad1aae3fa70a2383c5e910ca8d957a31af62c7/src/SoapCore/SoapEndpointMiddleware.cs#L446 This is where the exception is thrown.
So when UseBasicAuthentication is enabled the client tries to call the service with "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get" as the action-parameter.
According to https://specs.xmlsoap.org/ws/2004/09/transfer/WS-Transfer0904.pdf this is valid and should produce a specific response. My guess is that the client will accept pretty much any response though 😉
That behavior should probably be hardcoded in. Should definitely be solvable if you feel like giving it a go. My approach would probably be to have a shared OpeartionDescription for that specific action, but that's just based on a feeling. You are welcome to try whatever solution you feel is best.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.