I've been thrown in the deep end a little and just can't figure out how to get the XML to fill out my model correctly.
I can get the two strings filling in fine, but as soon as I put in a property of a customer class then it just doesn't get the data.
My classes are:
Application Class:
Imports System
Imports System.Runtime.Serialization
Imports System.ServiceModel
<DataContract([Namespace]:="Application")>
Public Class AdvantageApplication
<DataMember>
Public Property Test1 As String
<DataMember>
Public Property Test2 As String
<DataMember>
Public Property Advantage As Advantage
Public Sub New()
End Sub
End Class
Advantage Class:
Imports System
Imports System.Runtime.Serialization
<DataContract(IsReference:=True)>
Public Class Advantage
<DataMember>
Public Property NumberOfApplicants As String
Public Sub New()
End Sub
End Class
My controller is:
Namespace Api
Public Class SendApplicationController
Inherits ApiController
Public Function Post(<FromBody()> ByVal application As AdvantageApplication) As IHttpActionResult
End Function
End Namespace
The XML I'm currently trying to receive is:
<?xml version="1.0" ?>
- <AdvantageApplication xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Application">
<Test1>Testing</Test1>
<Test2>1234</Test2>
<Advantage>
<NumberOfApplicants>1</NumberOfApplicants>
</Advantage>
</AdvantageApplication>
Test1 and Test2 is receiving data fine but I get nothing for the NumberOfApplicants and I've tried so much and just can't figure out what I'm doing wrong.
Thanks in advance for any help.