Пример #1
0
        static void Main(string[] args)
        {
            SoapConnectorClient client = new SoapConnectorClient("BasicHttpBinding_SoapConnector");

            client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://servicedesk/webservices/soapconnector.svc");
            client.ImportData("JOB_IMPORT", "importjob", "importjob", System.IO.File.ReadAllText(@"C:\Users\Beheerder\data.xml"));
            client.Close();
        }
Пример #2
0
        public override void Send(InformationReader reader, bool sendBatteryInformation)
        {
            ExportConfigFile();

            SoapConnectorClient client = new SoapConnectorClient("BasicHttpBinding_SoapConnector");

            client.Endpoint.Address = new System.ServiceModel.EndpointAddress(url);

            string description = "";

            description += "<table width=\"80%\">";
            description += "<tr><td>Hostname:</td><td>" + ComputerInformation.MachineName + "</td></tr>";
            description += "<tr><td>IP Address(es):</td><td>" + String.Join("</td></tr><tr><td></td><td>", ComputerInformation.IPAddresses) + "</td></tr>";
            description += "<tr><td colspan=\"2\"></td></tr>";
            description += "<tr><td>Vendor:</td><td>" + ComputerInformation.Vendor + "</td></tr>";
            description += "<tr><td>Type:</td><td>" + ComputerInformation.Type + "</td></tr>";
            description += "<tr><td>Service Tag:</td><td>" + ComputerInformation.ServiceTag + "</td></tr>";
            description += "<tr><td colspan=\"2\"></td></tr>";
            description += "<tr><td>Design capacity:</td><td>" + reader.FullCapacity + " mWh</td></tr>";
            description += "<tr><td>Last Full Charge capacity:</td><td>" + reader.LastCapacity + " mWh</td></tr>";
            description += "<tr><td>Full Charge percentage:</td><td>" + reader.Percentage + "%</td></tr>";
            description += "</table>";

            if (sendBatteryInformation)
            {
                description += "<br/><br/>Extra information:<br/>";
                description += "<textarea width=\"50%\" height=\"300px\">" + reader.BatteryInfo + "<textarea>";
            }

            XElement data_object = CreateElement("Data");
            XElement obj         = CreateElement("Object", data_object, "Type", "Job", "Action", "InsertOrUpdate");

            CreateElement("Property", obj, "Name", "Context", "Value", "128");
            CreateElement("Property", obj, "Name", "SkillCategory", "Value", skillgroup);
            CreateElement("Property", obj, "Name", "Status", "Value", "4");
            CreateElement("Property", obj, "Name", "Description", "Value", ComputerInformation.MachineName + ": Bad battery health");
            CreateElement("Property", obj, "Name", "ReportText", "Value", description);
            CreateElement("Property", obj, "Name", "SupportLine", "Value", "FirstLine");
            CreateElement("Property", obj, "Name", "Equipment", "Value", GetNumeric(ComputerInformation.MachineName));
            CreateElement("Property", obj, "Name", "ReportForeignKeyEmployee", "Value", employeeId);
            CreateElement("Property", obj, "Name", "_TELEFOONNUMMER", "Value", "9");

            string xml = data_object.ToString();

            client.ImportData(jobName, username, password, xml);
            client.Close();
        }