/// Generate Xml Request public string GenerateXml() { string xml; StringWriter strStream = new StringWriter(); XmlTextWriter xmlWriter = new XmlTextWriter(strStream); // Start Tag <tag> xmlWriter.WriteStartElement(null, this.tag, null); // Attributes foreach (string key in this.xmlAttributes.Keys) { xmlWriter.WriteStartAttribute(null, key, null); xmlWriter.WriteString(this.xmlAttributes[key].ToString()); xmlWriter.WriteEndAttribute(); } // Message Body string text = xmlText.ToString(); if (text != "") { string bodyB64 = TextUtils.Base64Encode(text); xmlWriter.WriteString(bodyB64); } // End Tag </tag> xmlWriter.WriteEndElement(); // XML -> String xml = strStream.ToString(); // Close Xml Stream xmlWriter.Close(); return(xml); }