View Single Post
  #3 (permalink)  
Old 04-19-2006, 04:48 PM
MichaelA1 MichaelA1 is offline
Junior Member
 
Posts: 5
Default code

Here is the code I am using...

try
{
// txt file containing the xml to post
string xmlfile = "AuthToken.txt"

XmlDocument doc = new XmlDocument();

doc.Load(@"F:\Test Code\Zimbra\" +xmlfile);

HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://myurl:7071/service/admin/soap/");


// if SOAPAction header is required, add it here...
// this does not help either uncommented or commented
//req.Headers.Add("SOAPAction","\"\"");

req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";

Stream stm = req.GetRequestStream();

doc.Save(stm);

stm.Close();

//runs fine up to this point
//================================================= //Protocol exception generated here at Request::GetResponse()
HttpWebResponse myHttpWebResponse = (HttpWebResponse)req.GetResponse();



// Releases the resources of the response.

stm = myHttpWebResponse.GetResponseStream();
//myHttpWebResponse.Close();

//=================================================
}
catch(Exception e)
{
Console.WriteLine("error occured " + e.Message);
}
Reply With Quote