Results 1 to 4 of 4

Thread: C# Client

  1. #1
    Join Date
    Sep 2012
    Posts
    6
    Rep Power
    3

    Default C# Client

    Hello!
    I'm using Zimbra C# Client located at SourceForge.net Repository - [zimbra] Index of /trunk/ZimbraCSharpClient.

    I've tried to login with administrator and didn't work. With a simple user didn't work too. The only response that i get is the HTML of the login page...
    I searched internet and didn't found noting.

    SOAP MESSAGE:
    Code:
    <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>@USERNAME</name>
    <password>@PASSWORD</password>
    </AuthRequest>
    </soap:Body>
    </soap:Envelope>
    TEST CODE:
    Code:
    string soapMessage = SoapMessageBuilder(message, param);
    XmlDocument requestDoc = new XmlDocument();
    requestDoc.LoadXml(soapMessage);
    HttpWebRequest request = HttpWebRequestBuilder("http://@MYURL/");
    Stream stm = request.GetRequestStream();
    requestDoc.Save(stm);
    stm.Close();
    WebResponse resp = request.GetResponse();
    stm = resp.GetResponseStream();
    StreamReader r = new StreamReader(stm);
    XmlDocument responseDoc = new XmlDocument();
    responseDoc.LoadXml(r.ReadToEnd());
    "r.ReadToEnd()" returns HTML login page.

    Am i doing anything wrong?

    Thanks in advanced!

  2. #2
    Join Date
    Oct 2005
    Location
    USA, Canada and India
    Posts
    777
    Rep Power
    10

    Default

    probably your ("http://@MYURL/") is wrong
    it should be
    https://YOUR_ZIMBRA_SERVER:7071/service/admin/soap/

    you may also need to handle the self signed SSL cert wraning/exception in your code

    Raj
    i2k2 Networks
    Dedicated & Shared Zimbra Hosting Provider

  3. #3
    Join Date
    Sep 2012
    Posts
    6
    Rep Power
    3

    Default

    Thank you very much for your reply!
    Ok so i modified the url but still got an error: "The remote server returned an error: (500) Internal Server Error.".
    Forgot to mention in the first post a method: "HttpWebRequestBuilder". In this method i've swicth the value between "retVal.Headers.Add("SOAPAction", "\"\"");" and "retVal.Headers.Add("SOAPAction", "urn:zimbraAdmin");" but still doesn't work.


    SOAP MESSAGE:
    Code:
    <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>@USER</name>
    <password>@PASS</password>
    </AuthRequest>
    </soap:Body>
    </soap:Envelope>
    TEST CODE:
    Code:
     private static HttpWebRequest HttpWebRequestBuilder(string serviceAdminSoapUri)
    {
       HttpWebRequest retVal = (HttpWebRequest)WebRequest.Create(serviceAdminSoapUri);
       //retVal.Headers.Add("SOAPAction", "\"\"");
       retVal.Headers.Add("SOAPAction", "urn:zimbraAdmin");
       retVal.ContentType = "text/xml;charset=\"utf-8\"";
       retVal.Accept = "text/xml";
       retVal.Method = "POST";
       return retVal;
    }
    Code:
    string soapMessage = SoapMessageBuilder(message, param);
    XmlDocument requestDoc = new XmlDocument();
    requestDoc.LoadXml(soapMessage);
    HttpWebRequest request = HttpWebRequestBuilder("https://@MYZIMBRASERVER:7071/service/admin/soap");
    Stream stm = request.GetRequestStream();
    requestDoc.Save(stm);
    stm.Close();
    WebResponse resp = request.GetResponse();
    stm = resp.GetResponseStream();
    StreamReader r = new StreamReader(stm);
    XmlDocument responseDoc = new XmlDocument();
    responseDoc.LoadXml(r.ReadToEnd());
    return responseDoc;
    Thanks in advanced!

  4. #4
    Join Date
    Sep 2012
    Posts
    6
    Rep Power
    3

    Default

    Apparently i was using the wrong @USER.
    Thanks for the help!

Similar Threads

  1. Which client do you use with ZCS?
    By dipeshmehta in forum /etc
    Replies: 3
    Last Post: 12-05-2010, 02:21 PM
  2. Web Client
    By Headless in forum General Questions
    Replies: 0
    Last Post: 06-30-2009, 11:32 AM
  3. Replies: 12
    Last Post: 02-23-2008, 11:16 PM
  4. Web Client Performance and Basic client features
    By fviero in forum Administrators
    Replies: 1
    Last Post: 11-23-2007, 04:34 AM
  5. Help with Web Client
    By sixftsix in forum Installation
    Replies: 0
    Last Post: 05-11-2007, 10:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •