Skip to content

Instantly share code, notes, and snippets.

@csharpforevermore
Created November 14, 2013 14:29
Show Gist options
  • Save csharpforevermore/7467775 to your computer and use it in GitHub Desktop.
Save csharpforevermore/7467775 to your computer and use it in GitHub Desktop.
Post an XML document to the web service at the URL
public byte[] Register(string url, string emailAddress, string firstName, string lastName)
{
var swr = new StringWriter();
var xws = new XmlWriterSettings {OmitXmlDeclaration = true};
using (XmlWriter xwr = XmlWriter.Create(swr, xws))
{
xwr.WriteStartElement("register");
xwr.WriteAttributeString("email", emailAddress);
xwr.WriteAttributeString("firstname", firstName);
xwr.WriteAttributeString("lastname", lastName);
xwr.WriteEndElement();
}
byte[] arrRequestBytes = Encoding.UTF8.GetBytes(swr.ToString());
return _wclMain.UploadData(url, "POST", arrRequestBytes);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment