Пример #1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     // Initialise the MethodCall object with instance name and entry point
     // Login/Logout are not required if API key is specified
     try
     {
         // The first parameter can be the URL or instance name. It'll throw an exception if the instance name cannot be resolved.
         xmlmc = new XmlmcService(instanceName, serviceEntryPoint, davEntryPoint, string.Empty);
     }
     catch (RequestFailureException)
     {
         showWarningMessage(xmlmc.GetLastResponseErrorMessage());
     }
     catch (System.Net.WebException)
     {
         showWarningMessage(xmlmc.GetLastResponseErrorMessage());
     }
     catch (Exception ex)
     {
         showWarningMessage(ex.Message);
     }
 }
Пример #2
0
        public void MyTestInitialize()
        {
            xmlmcService = new XmlmcService(instanceUrl, xmlmc, dav, apiKey);
            // resolve the instance name
            if (instanceUrl.ToLower().StartsWith("http"))
            {
                Assert.IsTrue(string.Compare(instanceUrl, xmlmcService.ServerURL) == 0);
            }
            else
            {
                Assert.IsTrue(string.Compare(instanceUrl, xmlmcService.ServerURL) != 0);
                instanceUrl = xmlmcService.ServerURL;
            }

            if (string.IsNullOrWhiteSpace(apiKey))
            {
                xmlmcService.AddParam("userId", userId);
                xmlmcService.AddParam("password", password).EncodeValue(XmlmcEncoding.Base64);
                xmlmcService.Invoke("session", "userLogon");
                string sessionId = xmlmcService.GetResponseParamAsString("sessionId");
                Assert.IsNotNull(sessionId);
            }
        }