Shefali Lahariya

Shefali Lahariya

  • 1.4k
  • 257
  • 150.2k

how to solve An exception of type 'System.Xml.XmlException'

Oct 24 2017 7:53 AM
Hi,
 An exception of type 'System.Xml.XmlException' occurred in System.Xml.dll but was not handled in user code
 
Using code:
 
HttpWebRequest request = CreateSOAPWebRequest();
XmlDocument SOAPReqBody = new XmlDocument();
//SOAP Body Request
StringBuilder strRequest = new StringBuilder();
strRequest.Append("<?xml version='1.0' encoding='utf-8'?>");
strRequest.Append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:v1=\"http://portal.test.com/admin/v1_1\">");
strRequest.Append("<soapenv:Header/>");
strRequest.Append("<soap:Body>");
strRequest.Append("<v1:GetEntityByRoomKeyRequest>");
strRequest.Append("<v1:roomKey>" + constant.Roomkey + "</v1:roomKey");
strRequest.Append("</v1:GetEntityByRoomKeyRequest>");
strRequest.Append("</soap:Body>");
strRequest.Append("</soap:Envelope>");
SOAPReqBody.LoadXml(strRequest.ToString());
 
 
Please help me to solve this error.
 

Answers (2)