If you run this code it will throw a WebException. The inner exception is "Content-Length or Chunked Encoding cannot be set for an operation that does not write data." and I do not understand the nature of the problem. Can anyone cast light into this dark corner?
using System.Diagnostics;
using System.Net;
using System.Text;
namespace sandpit
{
static class Program
{
static void Main()
{
string INITIAL_URI = "http://docs.live.net/SkyDocsService.svc";
string SOAP = "<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetWebAccountInfoRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/clouddocuments"><BaseRequest><ClientAppId>SkyDrive Service Client</ClientAppId><Market>en-US</Market><SkyDocsServiceVersion>v1.0</SkyDocsServiceVersion></BaseRequest><GetReadWriteLibrariesOnly>false</GetReadWriteLibrariesOnly></GetWebAccountInfoRequest></s:Body></s:Envelope>";
using (WebClient wc = new WebClient())
{
wc.Encoding = Encoding.UTF8;
wc.Headers["SOAPAction"] = "GetWebAccountInfo";
wc.Headers["Accept-Language"] = "en-US";
wc.Headers["Accept"] = "text/xml";
wc.Headers["Content-Type"] = "text/xml; charset=utf-8";
string response = wc.UploadString(INITIAL_URI, SOAP);
Debug.WriteLine(response);
}
}
}
}