• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CssLib.WebServiceClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CssLib.WebServiceClient的典型用法代码示例。如果您正苦于以下问题:C# WebServiceClient类的具体用法?C# WebServiceClient怎么用?C# WebServiceClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WebServiceClient类属于CssLib命名空间,在下文中一共展示了WebServiceClient类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetAllCos

        public int GetAllCos()
        {
            if (ZimbraValues.zimbraValues.COSes.Count > 0)  // already got 'em
            return 0;
            lastError = "";
            WebServiceClient client = new WebServiceClient {
            Url = ZimbraValues.GetZimbraValues().Url, WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings)) {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, false);

            // body
            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            writer.WriteStartElement("GetAllCosRequest", "urn:zimbraAdmin");
            writer.WriteEndElement();           // GetAllCosRequest
            writer.WriteEndElement();           // soap body
            // end body

            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }

            string rsp = "";
            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            if (client.status == 0)
            {
            ParseGetAllCos(rsp);
            }
            else
            {
            string soapReason = ParseSoapFault(client.errResponseMessage);

            if (soapReason.Length > 0)
                lastError = soapReason;
            else
                lastError = client.exceptionMessage;
            }
            return client.status;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:52,代码来源:ZimbraAPI.cs


示例2: CreateTag

        public int CreateTag(string tag, string color, out string tagID)
        {
            tagID = "";
            lastError = "";

            int retval = 0;
            WebServiceClient client = new WebServiceClient
            {
            Url = ZimbraValues.GetZimbraValues().Url,
            WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings))
            {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, true);

            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");

            CreateTagRequest(writer, tag, color, -1);

            writer.WriteEndElement();           // soap body
            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }

            string rsp = "";
            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;
            if (client.status == 0)
            {
            ParseCreateTag(rsp, out tagID);       // get the id
            }
            else
            {
            string soapReason = ParseSoapFault(client.errResponseMessage);

            if (soapReason.Length > 0)
                lastError = soapReason;
            else
                lastError = client.exceptionMessage;
            }
            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:55,代码来源:ZimbraAPI.cs


示例3: GetAccount

        public int GetAccount(string accountname)
        {
            int retval = 0;

            lastError = "";
            WebServiceClient client = new WebServiceClient {
            Url = ZimbraValues.GetZimbraValues().Url, WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings)) {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, false);

            // body
            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            writer.WriteStartElement("GetAccountRequest", "urn:zimbraAdmin");

            WriteAccountBy(writer, accountname);

            writer.WriteEndElement();           // GetAccountRequest
            writer.WriteEndElement();           // soap body
            // end body

            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }

            string rsp = "";
            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;
            if (client.status == 0)
            {
            if (ParseGetAccount(rsp) == 0)      // length of name is 0 -- this is bad
                retval = ACCOUNT_NO_NAME;
            }
            else
            {
            string soapReason = ParseSoapFault(client.errResponseMessage);

            if (soapReason.Length > 0)
                lastError = soapReason;
            else
                lastError = client.exceptionMessage;
            }
            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:57,代码来源:ZimbraAPI.cs


示例4: CreateAccount

        public int CreateAccount(string accountname, string displayname, string givenname, string sn, string zfp, string defaultpw, bool mustChangePW, string cosid)
        {
            int retval = 0;

            lastError = "";

            if (displayname.Length == 0)
            {
            displayname = accountname.Substring(0, accountname.IndexOf("@"));
            }
            string zimbraForeignPrincipal = (zfp.Length > 0) ? zfp : "ad:" + displayname;
            WebServiceClient client = new WebServiceClient {
            Url = ZimbraValues.GetZimbraValues().Url, WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings)) {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, false);

            // body
            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            writer.WriteStartElement("CreateAccountRequest", "urn:zimbraAdmin");

            WriteNVPair(writer, "name", accountname);
            WriteNVPair(writer, "password", defaultpw);

            WriteAttrNVPair(writer, "a", "n", "displayName", displayname);
            if (givenname.Length > 0)
            {
                WriteAttrNVPair(writer, "a", "n", "givenName", givenname);
            }
            if (sn.Length > 0)
            {
                WriteAttrNVPair(writer, "a", "n", "sn", sn);
            }
            WriteAttrNVPair(writer, "a", "n", "zimbraForeignPrincipal", zimbraForeignPrincipal);
            WriteAttrNVPair(writer, "a", "n", "zimbraCOSId", cosid);
            if (mustChangePW)
            {
                WriteAttrNVPair(writer, "a", "n", "zimbraPasswordMustChange", "TRUE");
            }

            writer.WriteEndElement();           // CreateAccountRequest
            writer.WriteEndElement();           // soap body
            // end body

            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }

            string rsp = "";
            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;
            if (client.status == 0)
            {
            if (ParseCreateAccount(rsp) == 0)   // length of name is 0 -- this is bad
                retval = ACCOUNT_CREATE_FAILED;
            }
            else
            {
            string soapReason = ParseSoapFault(client.errResponseMessage);

            if (soapReason.Length > 0)
                lastError = soapReason;
            else
                lastError = client.exceptionMessage;
            }
            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:80,代码来源:ZimbraAPI.cs


示例5: CreateContacts

        public int CreateContacts(List<Dictionary<string, string> > lContacts, string folderPath =
        "")
        {
            lastError = "";

            // Create in Contacts unless another folder was desired
            string folderId = "7";

            if (folderPath.Length > 0)
            {
            folderId = FindFolder(folderPath);
            if (folderId.Length == 0)
                return CONTACT_CREATE_FAILED_FLDR;
            }

            // //////
            WebServiceClient client = new WebServiceClient {
            Url = ZimbraValues.GetZimbraValues().Url, WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            int retval = 0;
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings)) {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, true);

            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            writer.WriteStartElement("BatchRequest", "urn:zimbra");
            for (int i = 0; i < lContacts.Count; i++)
            {
                Dictionary<string, string> contact = lContacts[i];
                CreateContactRequest(writer, contact, folderId, i);
            }
            writer.WriteEndElement();           // BatchRequest
            writer.WriteEndElement();           // soap body
            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }

            string rsp = "";

            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;
            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:55,代码来源:ZimbraAPI.cs


示例6: AddRules

        public int AddRules(Dictionary<string, string> rules)
        {
            lastError = "";

            WebServiceClient client = new WebServiceClient
            {
            Url = ZimbraValues.GetZimbraValues().Url,
            WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            int retval = 0;
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings))
            {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, true);

            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            SetModifyFilterRulesRequest(writer, rules);

            writer.WriteEndElement();           // soap body
            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }
            string rsp = "";

            WriteSoapLog(sb.ToString(),true);
            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;
            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:39,代码来源:ZimbraAPI.cs


示例7: AddTask

        public int AddTask(Dictionary<string, string> appt, string folderPath = "")
        {
            lastError = "";

            // Create in Tasks unless another folder was desired
            string folderId = "15";

            if (folderPath.Length > 0)
            {
            folderId = FindFolder(folderPath);
            if (folderId.Length == 0)
                return TASK_CREATE_FAILED_FLDR;
            }

            // //////
            WebServiceClient client = new WebServiceClient
            {
            Url = ZimbraValues.GetZimbraValues().Url,
            WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            int retval = 0;
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings))
            {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, true);

            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            SetTaskRequest(writer, appt, folderId);

            writer.WriteEndElement();           // soap body
            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }
            string rsp = "";
            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;
            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:50,代码来源:ZimbraAPI.cs


示例8: AddOOO

        public int AddOOO(string OOOInfo, bool isServer)
        {
            lastError = "";

            if (OOOInfo.Length == 0)
            {
            return OOO_NO_TEXT;
            }

            bool isOOOEnabled = OOOInfo.Substring(0, 1) == "1";
            if ((!isOOOEnabled) && (OOOInfo.Length == 2))   // 0:
            {
            return 0;   // it's ok -- just no need to do anything
            }

            WebServiceClient client = new WebServiceClient
            {
            Url = ZimbraValues.GetZimbraValues().Url,
            WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            int retval = 0;
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings))
            {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, isServer);

            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            SetModifyPrefsRequest(writer, isOOOEnabled, OOOInfo);

            writer.WriteEndElement();           // soap body
            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }
            string rsp = "";
            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;
            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:50,代码来源:ZimbraAPI.cs


示例9: AddMessages

        public int AddMessages(List<Dictionary<string, string> > lMessages)
        {
            int retval = 0;

            lastError = "";

            string uploadInfo = "";

            System.Type type = typeof (ZimbraMessage);
            FieldInfo[] myFields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
            WebServiceClient client = new WebServiceClient {
            Url = ZimbraValues.GetZimbraValues().Url, WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings)) {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, true);

            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            writer.WriteStartElement("BatchRequest", "urn:zimbra");
            for (int i = 0; i < lMessages.Count; i++)
            {
                Dictionary<string, string> message = lMessages[i];

                ZimbraMessage zm = new ZimbraMessage("", "", "", "", "");

                for (int j = 0; j < myFields.Length; j++)       // use reflection to set ZimbraMessage object values
                {
                    string nam = (string)myFields[j].Name;

                    if (nam == "folderId")
                        myFields[j].SetValue(zm, FindFolder(message[nam]));
                    else
                        myFields[j].SetValue(zm, message[nam]);
                }

                bool isInline = false;
                if (message["wstrmimeBuffer"].Length > 0)
                {
                    //
                }
                else
                {
                    FileInfo f = new FileInfo(zm.filePath);
                    isInline = (f.Length < INLINE_LIMIT);
                }

                if (isInline)
                    uploadInfo = zm.filePath;
                else
                {
                    Log.debug("Begin UploadFile");
                    string tmp = message["wstrmimeBuffer"];
                    retval = UploadFile(zm.filePath, tmp, "", "", STRING_MODE, out uploadInfo);
                    Log.debug("End UploadFile");
                }
                if (retval == 0)
                    AddMsgRequest(writer, uploadInfo, zm, isInline, -1);
                File.Delete(zm.filePath);
            }
            writer.WriteEndElement();           // BatchRequest
            writer.WriteEndElement();           // soap body
            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }

            string rsp = "";
            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;

            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:83,代码来源:ZimbraAPI.cs


示例10: AddMessage

        public int AddMessage(Dictionary<string, string> message)
        {
            lastError = "";

            string uploadInfo = "";
            int retval = 0;
            ZimbraMessage zm = new ZimbraMessage("", "", "", "", "");

            System.Type type = typeof (ZimbraMessage);
            FieldInfo[] myFields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
            for (int i = 0; i < myFields.Length; i++)       // use reflection to set ZimbraMessage object values
            {
            string nam = (string)myFields[i].Name;

            if (nam == "folderId")
                myFields[i].SetValue(zm, FindFolder(message[nam]));
            else
                myFields[i].SetValue(zm, message[nam]);
            }

            bool isInline = false;
            if (message["wstrmimeBuffer"].Length > 0)
            {
            //
            }
            else
            {
            FileInfo f = new FileInfo(zm.filePath);// use a try/catch?
            isInline = (f.Length < INLINE_LIMIT);
            }

            if (isInline)
            uploadInfo = zm.filePath;
            else
            {
            //Log.debug("Begin UploadFile");
            string tmp = message["wstrmimeBuffer"];
            retval = UploadFile(zm.filePath, tmp, "", "", STRING_MODE, out uploadInfo);
            //Log.debug("End UploadFile");
            }
            if (retval == 0)
            {
            WebServiceClient client = new WebServiceClient {
                Url = ZimbraValues.GetZimbraValues().Url, WSServiceType =
                    WebServiceClient.ServiceType.Traditional
            };
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings)) {
                writer.WriteStartDocument();
                writer.WriteStartElement("soap", "Envelope",
                    "http://www.w3.org/2003/05/soap-envelope");

                WriteHeader(writer, true, true, true);

                writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");

                AddMsgRequest(writer, uploadInfo, zm, isInline, -1);

                writer.WriteEndElement();       // soap body
                writer.WriteEndElement();       // soap envelope
                writer.WriteEndDocument();
            }

            string rsp = "";
            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;
            if (client.status == 0)
            {
                string mID = "";

                ParseAddMsg(rsp, out mID);      // get the id
            }
            else
            {
                string soapReason = ParseSoapFault(client.errResponseMessage);
                string errMsg = (soapReason.IndexOf("upload ID: null") != -1)    // FBS bug 75159 -- 6/7/12
                                ? "Unable to upload file. Please check server message size limits (Global Settings General Information and MTA)."
                                : soapReason;
                if (soapReason.Length > 0)
                {
                    lastError = soapReason;
                    Log.err("Error on message", message["Subject"], "--", errMsg);
                }
                else
                {
                    lastError = client.exceptionMessage;
                }
            }
            }
            //File.Delete(zm.filePath);
            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:99,代码来源:ZimbraAPI.cs


示例11: AddAppointment

        public int AddAppointment(Dictionary<string, string> appt, string folderPath = "")
        {
            lastError = "";

            // Create in Calendar unless another folder was desired
            string folderId = "10";

            if (folderPath.Length > 0)
            {
            folderId = FindFolder(folderPath);
            if (folderId.Length == 0)
                return APPT_CREATE_FAILED_FLDR;
            }

            // //////
            WebServiceClient client = new WebServiceClient {
            Url = ZimbraValues.GetZimbraValues().Url, WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            int retval = 0;
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings))
            {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, true, true, true);

            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            SetAppointmentRequest(writer, appt, folderId);

            writer.WriteEndElement();           // soap body
            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }
            string rsp = "";
            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);

            WriteSoapLog(rsp.ToString(),false);
            retval = client.status;
            if (client.status != 0)
            {
            string soapReason = ParseSoapFault(client.errResponseMessage);
            if (soapReason.Length > 0)
            {
                lastError = soapReason;
                Log.err("Error on appointment", appt["su"], "--", soapReason);
            }
            }
            return retval;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:57,代码来源:ZimbraAPI.cs


示例12: Logon

        //
        // API methods /////////
        public int Logon(string hostname, string port, string username, string password, bool
        isSecure, bool isAdmin)
        {
            if (ZimbraValues.GetZimbraValues().AuthToken.Length > 0)
            return 0;                           // already logged on
            lastError = "";

            // FBS Bug 73394 -- 4/26/12 -- rewrite this section
            string mode = isSecure ? "https://"            : "http://";
            string svc  = isAdmin  ? "/service/admin/soap" : "/service/soap";
            string urn  = isAdmin  ? "urn:zimbraAdmin"     : "urn:zimbraAccount";
            ZimbraValues.GetZimbraValues().Url = mode + hostname + ":" + port + svc;
            // end Bug 73394

            WebServiceClient client = new WebServiceClient {
            Url = ZimbraValues.GetZimbraValues().Url, WSServiceType =
                WebServiceClient.ServiceType.Traditional
            };
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings)) {
            writer.WriteStartDocument();
            writer.WriteStartElement("soap", "Envelope",
                "http://www.w3.org/2003/05/soap-envelope");

            WriteHeader(writer, false, false, false);

            // body
            writer.WriteStartElement("Body", "http://www.w3.org/2003/05/soap-envelope");
            writer.WriteStartElement("AuthRequest", urn);
            if (isAdmin)
                WriteNVPair(writer, "name", username);
            else
                WriteAccountBy(writer, username);
            WriteNVPair(writer, "password", password);

            writer.WriteEndElement();           // AuthRequest
            writer.WriteEndElement();           // soap body
            // end body

            writer.WriteEndElement();           // soap envelope
            writer.WriteEndDocument();
            }

            string rsp = "";

            WriteSoapLog(sb.ToString(),true);

            client.InvokeService(sb.ToString(), out rsp);
            WriteSoapLog(rsp.ToString(),false);

            if (client.status == 0)
            {
            ParseLogon(rsp, isAdmin);
            ZimbraValues.GetZimbraValues().HostName = hostname;
            ZimbraValues.GetZimbraValues().Port = port;
            }
            else
            {
            string soapReason = ParseSoapFault(client.errResponseMessage);

            if (soapReason.Length > 0)
                lastError = soapReason;
            else
                lastError = client.exceptionMessage;
            }
            return client.status;
        }
开发者ID:bucchi,项目名称:zimbra-sources,代码行数:72,代码来源:ZimbraAPI.cs



注:本文中的CssLib.WebServiceClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Mocks.ParserMock类代码示例发布时间:2022-05-24
下一篇:
C# Server.DataPortalContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap