kiran a

kiran a

  • NA
  • 20
  • 9.5k

Not able bind xml node with url having query string - .net core 3.1

Dec 29 2020 2:05 PM
Hi Team,
 
I am trying to receive xml response as below but iam not able to bind to xml element because of "&" in recordingurl node.
 
I have xml resonse as below.
  1. <?xml version='1.0'?>  
  2. <request>  
  3. <charge>2312</charge>  
  4. <reason>RING</reason>  
  5. <hangup>none</hangup>  
  6. <recording_url>https://abc.testnow.com/call_recordings_wav.php?sid=G112Qt7S&ks=7273996885894aef526d566605aeed67</recording_url>  
  7. </request>  
My web api code :
  1. [HttpPost]  
  2. [Route("cdr")]  
  3. [Consumes("application/xml")]  
  4. public async Task<int> CDACallback([xmlelement]request CDaCallbackModel)  
  5. {  
  6. }  
added below line in startup.cs
  1. services.AddMvc().AddXmlSerializerFormatters();  
Getting below error message in postman.
 
{
"errors": {
"": [
"An error occurred while deserializing input data."
]
},
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "|8f5da348-4786fb0f473302ff."
}
 
Is not possible to bind to XML element ?

Answers (4)