0

I have a 3rd party that is sending SOAP XML messages, as the HTTP message body (using HTTP Post). I need to write a program to accept / process these messages.

I have a specification document which contains 2 WSDL definitions - GetTransaction and CutOff.

I am trying to use Postman to send a test message. Content-Type is set to application/xml and the body is set to raw / XML.

I am using C#, ASP.Net (4.7.2), the code is in a Class Library. I have a Controller (ApiController) with:

[HttpPost]
[ValidationAttributes.RequireHttps]
public HttpResponseMessage Service(XmlDocument reqData)

but reqData is always null. I have tried different types instead of XmlDocument.

Now if probably a good time to say that this is all new to me - I've not created a program to accept SOAP messages before.

Should I be creating a WCF Service Application (rather than a .Net Framework Class Library)?

I've tried adding the WSDL "definitions" but they don't seem to produce anything useful. E.g. there is reference to a "GetTransaction" method, but it has a parameter list of about 150 items!?

I have found quite a lot of stuff via Google but it always seems to be about sending, rather than receiving, SOAP messages.

I appreciate that I have not really included much code to look at, but I feel like I've started from the wrong place. So, any basic guidance, suggestions or links to tutorial sites would be most welcome.

GordonS
  • 193
  • 4
  • 9
  • 1
    Try accepting a String or HttpRequestMessage. Then access the body and parse it using System.Xml.Linq.XDocument. If you want to use WCF instead of handling the XML directly see: https://stackoverflow.com/questions/950150/how-to-use-a-wsdl-file-to-create-a-wcf-service-not-make-a-call – David Browne - Microsoft Oct 29 '20 at 17:38
  • Post the xml. Data is null ether due to the tag name not found or a namespace issue. – jdweng Oct 29 '20 at 17:50
  • 1
    @DavidBrowne-Microsoft using HttpRequestMessage worked. – GordonS Oct 30 '20 at 13:29

0 Answers0