I'm trying to get some data from a WebService using SOAP request. The SOAP body should contain an SQL query. Whenever I'm using the <
character it causes the above mentioned error at SOAPReqBody.LoadXml()
. How can I fix this?
HttpWebRequest request = CreateSOAPWebRequest();
XmlDocument SOAPReqBody = new XmlDocument();
SOAPReqBody.LoadXml(@"<?xml version=""1.0"" encoding=""utf-8""?>
<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
<soap:Body>
<Query xmlns=""http://LifaOIS.DK/OISService"">
<UID>" + uid + @"</UID>
<PWD>" + pwd + @"</PWD>
<SQL>" + sql + @"</SQL>
<Meta>" + meta + @"</Meta>
</Query>
</soap:Body>
</soap:Envelope>");