Exemple #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            // Note: Please enable SOAP/REST services in your SNow dev instance table(s), Also,
            // Go to system web services --> properties -> enable the 3rd option from the bottom.(This property sets the elementFormDefault attribute of the embedded XML schema to the value of unqualified)
            ServiceNowSoapClient client = new ServiceNowSoapClient();

            client.ClientCredentials.UserName.UserName = "******"; // makhan8 have SOAP role in SNow.
            client.ClientCredentials.UserName.Password = "******";

            insert         newRecord      = new insert();
            insertResponse insertResponse = new insertResponse();

            newRecord.first_name   = "Jackson";
            newRecord.last_name    = "Chris";
            newRecord.phone_number = "911-911-9999";
            //newRecord.number = "CUS3048232";
            try
            {
                insertResponse = client.insert(newRecord);
                TextBox1.Text  = insertResponse.sys_id;
            }
            catch (Exception ex)
            {
                TextBox1.Text = ex.Message;
            }
            finally { client.Close(); }
        }
Exemple #2
0
        /// <summary>
        /// This function creates a new incident in ServiceNOW
        /// </summary>
        /// <param name="Credential">A credential object that gets passed to the soap client for authentication</param>
        /// <param name="Incident">An insert object that contains the data to be inserted into ServiceNOW</param>
        /// <returns>An insertResponse object containing data returned from ServiceNOW</returns>
        public static insertResponse NewIncident(NetworkCredential Credential, insert Incident, string ServiceNowUrl)
        {
            try
            {
                string userName             = Credential.UserName;
                string userPass             = Credential.Password;
                ServiceNowSoapClient client = soapClient(userName, userPass, ServiceNowUrl);

                insertResponse response = new insertResponse();

                response = client.insert(Incident);
                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// This function creates a new incident in ServiceNOW
        /// </summary>
        /// <param name="Credential">A credential object that gets passed to the soap client for authentication</param>
        /// <param name="Incident">An insert object that contains the data to be inserted into ServiceNOW</param>
        /// <returns>An insertResponse object containing data returned from ServiceNOW</returns>
        public static insertResponse NewIncident(NetworkCredential Credential, insert Incident, string ServiceNowUrl)
        {
            try
            {
                string userName = Credential.UserName;
                string userPass = Credential.Password;
                ServiceNowSoapClient client = soapClient(userName, userPass, ServiceNowUrl);

                insertResponse response = new insertResponse();

                response = client.insert(Incident);
                return response;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// This function inserts a server into the ServiceNow CI Database
        /// </summary>
        /// <param name="Credential">A NetworkCredential object that gets passed to the soap client for authentication</param>
        /// <param name="Server">An insert object that contains the data to be inserted into ServiceNOW</param>
        /// <returns>An insertResponse object containing data returned from ServiceNOW</returns>
        public static insertResponse NewServer(NetworkCredential Credential, insert Server, string ServiceNowUrl)
        {
            try
            {
                string userName = Credential.UserName;
                string userPass = Credential.Password;
                ServiceNowSoapClient client = soapClient(userName, userPass, ServiceNowUrl);

                insertResponse response = new insertResponse();

                if (!(itemExist(client, Server.name)))
                {
                    response = client.insert(Server);
                }
                return response;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
        /// <summary>
        /// This function inserts a server into the ServiceNow CI Database
        /// </summary>
        /// <param name="Credential">A NetworkCredential object that gets passed to the soap client for authentication</param>
        /// <param name="Server">An insert object that contains the data to be inserted into ServiceNOW</param>
        /// <returns>An insertResponse object containing data returned from ServiceNOW</returns>
        public static insertResponse NewServer(NetworkCredential Credential, insert Server, string ServiceNowUrl)
        {
            try
            {
                string userName             = Credential.UserName;
                string userPass             = Credential.Password;
                ServiceNowSoapClient client = soapClient(userName, userPass, ServiceNowUrl);

                insertResponse response = new insertResponse();

                if (!(itemExist(client, Server.name)))
                {
                    response = client.insert(Server);
                }
                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void cmdSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                NetworkCredential Credential = new NetworkCredential(txtUsername.Text, txtPassword.Text);

                insert newIncident = new insert();
                newIncident.caller_id         = txtUser.Text;
                newIncident.opened_by         = txtUser.Text;
                newIncident.watch_list        = txtUser.Text;
                newIncident.contact_type      = "Email";
                newIncident.short_description = txtShortDescription.Text;
                newIncident.description       = txtDescription.Text;

                insertResponse response = incident.Incident.NewIncident(Credential, newIncident, txtUrl.Text);
                MessageBox.Show(response.number);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }