AnsweredAssumed Answered

Invalid XML format: Cannot find the declaration of element 'String'.

Question asked by Scott Ramuno on May 25, 2018

I'm trying add filter criteria to my Qualys webapi call, but get a "Invalid XML format: Cannot find the declaration of element 'String'." message along with a responseCode of "INVALID_XML".

 

My code looks like this:

var request = new RestRequest("qps/rest/3.0/search/was/webapp", Method.POST);
request.RequestFormat = DataFormat.Xml;

var searchXml = @"<ServiceRequest><filters><Criteria field=\""tag\"" operator=\""CONTAINS\"">Benefits TASNA</Criteria></filters></ServiceRequest>";
request.AddBody(searchXml);
var response = client.Execute(request);

 

The API call does work when I remove the request.AddBody.

 

What am I doing wrong?

Outcomes