Ejemplo n.º 1
0
        public void TestBuildXMLAndComplexType()
        {
            xmlmcService.ClearParams();
            //setDiagnosticsLevel with complex type params

            xmlmcService.AddParam("severityLevel", "all");
            List <XmlmcParam> paramList = new List <XmlmcParam>();

            paramList.Add(new XmlmcParam("general", "true"));
            paramList.Add(new XmlmcParam("system", "true"));
            paramList.Add(new XmlmcParam("process", "true"));
            paramList.Add(new XmlmcParam("security", "true"));
            paramList.Add(new XmlmcParam("comms", "true"));
            paramList.Add(new XmlmcParam("database", "true"));
            paramList.Add(new XmlmcParam("sql", "true"));
            paramList.Add(new XmlmcParam("perf", "true"));
            paramList.Add(new XmlmcParam("scripts", "true"));

            xmlmcService.AddParam("logMessageGroup", paramList);

            // come back here
            //mc.AddParam(doc);
            xmlmcService.AddParam("enableResultXmlSchemaValidation", "true");
            xmlmcService.AddParam("enableDatabaseSecurityHinting", "true");

            string xml = xmlmcService.GetInvokeXML("session", "setDiagnosticsLevel");

            System.Diagnostics.Debug.Print(xml);
            xmlmcService.Invoke("session", "setDiagnosticsLevel");
            xml = xmlmcService.GetResponseXML();
        }
Ejemplo n.º 2
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            // Only if API key is not specified
            // Login to the server
            // For more information: https://api.hornbill.com/docs/session/?op=userLogon
            try
            {
                xmlmc.AddParam("userId", userId);
                xmlmc.AddParam("password", password).EncodeValue(XmlmcEncoding.Base64);
                xmlmc.Invoke("session", "userLogon");
                // Send the request xml to text box
                sendTextToRequestBox(xmlmc.GetInvokeXML("session", "userLogon"));
                // Send the result xml to text box
                sendTextToOutputBox(xmlmc.GetResponseXML());
                // To get the session ID from the XML results
                string sessionId = xmlmc.GetResponseParamAsString("sessionId");
                sendTextToOutputBox(Environment.NewLine + "Session ID: " + sessionId, true);

                // See how to construct a complex type
                // registerUserLocation();
            }
            catch (RequestFailureException)
            {
                showWarningMessage(xmlmc.GetLastResponseErrorMessage());
            }
            catch (System.Net.WebException)
            {
                showWarningMessage(xmlmc.GetLastResponseErrorMessage());
            }
            catch (Exception ex)
            {
                showWarningMessage(ex.Message);
            }
        }