Created
November 14, 2013 14:29
-
-
Save csharpforevermore/7467775 to your computer and use it in GitHub Desktop.
Post an XML document to the web service at the URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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