Our current web site need to integrate with partners’ sites in which XML (with Http Post) is uesed as communication protocol.
Do you know how to map XML elements, like below, to Action method parameters?
<?xml version="1.0" encoding="utf-8"?>
<xBalance>
<MemberCode>bu00001</MemberCode>
</xBalance>
Thanks.
You could use a custom model binder. Start with a view model which will represent this XML structure:
then write a custom model binder for this view model:
which will be registered in
Application_Start:Now your controller action might look like this:
You might need to decorate your action with the
[ValidateInput(false)]attribute as you will be POSTing XML to it and ASP.NET doesn’t like characters such as<and>to be sent to the server.