Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-19-2006, 05:26 PM
Junior Member
 
Posts: 5
Question SOAP post HTTP error

Hi, I am trying to post SOAP to http://dev.mydomain.com:7071/service/admin/soap/

I am using MS.Net's HttpSoapRequest and Respose classes to post SOAP request. The xml is pasted below:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<context xmlns="urn:zimbra"/>
</soap:Header>
<soap:Body>
<AuthRequest xmlns="urn:zimbraAdmin">
<name>admin@mydomain.com</name>
<password>mystrongpassword</password>
</AuthRequest>
</soap:Body>
</soap:Envelope>


But I am consistently getting the following error in VS.Net:

"The underlying connection was closed: The server committed an HTTP protocol violation."

I would appreciate any suggestions?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 04-19-2006, 05:35 PM
sam sam is offline
Zimbra Employee
 
Posts: 821
Default

where's the documentation for HttpSoapRequest?
__________________
Sam Khavari

:: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::
Reply With Quote
  #3 (permalink)  
Old 04-19-2006, 05:48 PM
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
  #4 (permalink)  
Old 04-19-2006, 05:49 PM
Zimbra Employee
 
Posts: 4,792
Default Ssl?

It should be an SSL request so:

https://myurl:7071/service/admin/soap/
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
  #5 (permalink)  
Old 04-19-2006, 05:57 PM
Junior Member
 
Posts: 5
Question must use SSL for dev also?

Oh, Does the URL have to be using SSL? I was just testing and using "post" to HTTPS would require more code writing. So to cut out some dev time I have just been posting to http for testing.

But could it be why this is throwing the exception?
Reply With Quote
  #6 (permalink)  
Old 04-19-2006, 06:08 PM
Zimbra Employee
 
Posts: 4,792
Default

By default we only accept SSL on that port. So unless you've configured it for HTTP it won't work. The exception IMHO is the HTTP parser barfing on the SSL handshake.
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
  #7 (permalink)  
Old 04-19-2006, 06:16 PM
Junior Member
 
Posts: 5
Default Thanks.

Great, Thanks. I will code the complete SSL posting functionalities and let you know my progress.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.