2 Replies Latest reply on May 31, 2016 7:31 AM by Waldy

    asp.net webpage to use Event manager to move along process

    brian_bakewell Apprentice

      I'm trying to create an asp.net webpage to make so the happiness factor  can be completed by people who are not within our network as a lot of our customers are external to us. I've created a basic website where the customer can select the happiness value from a dropdown and add notes and then I'm trying to use the event manager to add this to the incident. The code I am using is as below but id does not seem to work does anyone know where I am going wrong as I can't see any documentation on doing this for Landesk.

       

       

      Code

      protected void post_event()
      {
          try
          {
              HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://itbm-test/servicedesk.eventmanager");

              var postData = "Parameter1=" + Happiness_ddl.SelectedValue.ToString();
              postData += "&Parameter16=" + Details_tb.Text;
              postData += "&EventSource=Survey";
              postData += "&EventType=Add Survey";
              postData += "&Title=";
              postData += "&ObjectInstanceGuid=" + guid_id.Text;
              var data = Encoding.ASCII.GetBytes(postData);

              myReq.Method = "POST";
              myReq.ContentType = "text/xml";
              myReq.Timeout = 30000;
              myReq.ContentLength = data.Length;
              using (var stream = myReq.GetRequestStream())
              {
         stream.Write(data, 0, data.Length);
         Error_Label.Text = postData;
              }
      }
      catch (Exception ex)
      {
        Error_Label.Text = Error_Label.Text + "<BR>post_event" + ex.Message;
      }
      }

       

        • 1. Re: asp.net webpage to use Event manager to move along process
          Waldy Employee

          Hi Brian,

                        have you set a default document for the ServiceDesk.EventManager web site, because you don't have one in the URL?

          • 2. Re: asp.net webpage to use Event manager to move along process
            Waldy Employee

            This code worked for me.  I'm using the EventLog.asmx web service end point and not the PostMessage.aspx as that does not accept the process GUID.  EventSource, EventType and Title are required parameters, the service will return false if you do not pass all three values..

             

                        HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(http://localhost/servicedesk.eventmanager/eventlog.asmx);

             

                        var postData = "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
                            + "<soap:Body>"
                            + "<PostIntegrationEvent xmlns=\"http://tempuri.org/\">"
                            + "<EventSource>Survey</EventSource>"
                            + "<EventType>Add Survey</EventType>"
                            + "<Title>Test</Title>"
                            + "<ProcessGuid>366452C7-9F24-430D-8F8B-94E94F75DF4D</ProcessGuid>"
                            + "<Parameter1>Some text</Parameter1>"
                            + "<Parameter16>These are the details</Parameter16>"
                            + "</PostIntegrationEvent>"
                            + "</soap:Body>"
                            + "</soap:Envelope>";
                       
                        var data = Encoding.ASCII.GetBytes(postData);

             

                        myReq.Method = "POST";
                        myReq.ContentType = "text/xml; charset=utf-8";
                        myReq.Timeout = 30000;
                        myReq.ContentLength = data.Length;


                        using (var stream = myReq.GetRequestStream())
                        {
                            stream.Write(data, 0, data.Length);
                        }

             

                        HttpWebResponse hwresponse = (HttpWebResponse)myReq.GetResponse();

             

                        if (hwresponse.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            System.IO.Stream responseStream = hwresponse.GetResponseStream();
                            System.IO.StreamReader myStreamReader = new System.IO.StreamReader(responseStream);
                            string responseData = myStreamReader.ReadToEnd();
                        }