DigDes / SoapCore

SOAP extension for ASP.NET Core
MIT License
996 stars 376 forks source link

MessageEncoder fails to find a match if Request.ContentType doesn't contain a charset #724

Closed andersjonsson closed 2 years ago

andersjonsson commented 2 years ago

As I am porting an old web service api https://api.legaonline.se/rentalApi.asmx I had some trouble with a collection of postman scripts. My scripts uses soap12 and the new service only works if I add the Soap12 MessageEncoder first.

Turns out that the ContentType of my postman requests was application/soap+xml. In that case it doesn't match a MessageEncoder with Soap12 and UTF8. That led to the server picking the first MessageEncoder as a fallback, and if that was Soap11 I got an error.

I'll submit a PR that allows Request.ContentType to be empty and that does a second pass to find a MessageEncoder with the correct MediaType as fallback, so that you will at least get the right protocol version.

andersjonsson commented 2 years ago

I forgot to mention that the web service api supports skipping charset, without extra config. So this is a question of backwards compatibility for us.