Last post Sep 20, 2016 11:49 AM by Yohann Lu
Sep 15, 2016 09:30 AM|sudamap|LINK
I want to post a SOAP XML based message to Web API which i have created in ASP.NET core project template.
Right now i am getting unsupported media type error when i post it with content-type as application/soap+xml.
I know that we should be sending SOAP message to WCF based service but our requirement is like this only. I should be able to consume SOAP message in web API.
Sep 16, 2016 04:20 AM|Yohann Lu|LINK
As far as I know, WebApi does not support SOAP out of the box. But Web API is a quite flexible framework and you could "adapt" it to handle SOAP.
I suggest you can try the following suggestion.
You can parse the received SOAP messages manually (they are plain XML after all) and manually generating the responses as XML strings, then sending them with the appropriate content-type header.
The following links for your reference.
Read Soap Message using C#:
Parse and Read SOAP XML using C#:
Sep 16, 2016 05:05 AM|sudamap|LINK
Thanks for your response. Let me try to explain you situation:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
Action Method in controller which i created using asp.net core template
public async Task<IActionResult> Post([FromBody] AddressLookup addressLookup)
Now when i post this using fiddler with content type as application/soap +xml i get unsupported media type error. All i want to do is accept SOAP message in Post action and do something sort of mapping and send a response back but seems to get stuck here.
If you can suggest something specific to this that will be a great help.
Sep 20, 2016 11:49 AM|Yohann Lu|LINK
As far as I know, WebApi does not support SOAP out of the box. You can parse the received SOAP messages manually (they are plain XML after all) and manually generating the responses as XML strings, then sending them to Web API.