Re: Creating Incidents with the SDK

  •  08-08-2007, 1:23 PM

    Re: Creating Incidents with the SDK

    Thanks for the reply Tom. I did look at the video and I went, I think, through all the examples. I was able to interface my home grown time and billing software with it. I used it to lookup Incidents, features, tasks and defects that are created in Ontime and reference the id in the time and billing app. I have never created anything from it. I wonder if anyone has done this at all because I just can't see what I'm doing wrong. Thanks for any help

     Here's the code and error

        public class DataService: System.Web.Services.WebService
        {

            OntimeIncidentService.Incident Incident = new OntimeIncidentService.Incident();
            OntimeIncidentService.IncidentHandler iHandler = new OntimeIncidentService.IncidentHandler();
            private Guid TOKEN = new Guid(System.Configuration.ConfigurationSettings.AppSettings["SecurityToken"]);

     

     private DataSet returnDataSet(string strSQL, SqlConnection conn)
            {
                SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
                DataSet ds = new DataSet();
                ds.Locale = CultureInfo.InvariantCulture;
                try
                {
                    if (conn.State != ConnectionState.Open)
                    {
                        conn.Open();
                    }
                    da.Fill(ds, "Table");
                }
                catch (Exception ex)
                {
                   //IncidentIncident = new Incident();
                    Incident.ActualDuration = 0;
                    Incident.ActualUnitTypeId = 0;
                    Incident.Archived = false;
                    Incident.AssignedToId = 1;
                    Incident.CompletionDate = System.Convert.ToDateTime("1/1/1899 12:00:00 AM");
                    Incident.CreatedById = 1;
                    Incident.CreatedDateTime = System.DateTime.Now;
                    Incident.Description = ex.Message;
                    Incident.DueDate = System.Convert.ToDateTime("1/1/1899 12:00:00 AM");
                    Incident.EscalationLevelId = 0;
                    Incident.EstimatedDuration = 0;
                    Incident.HasAlerts = false;
                    Incident.HasAttachments = false;
                    Incident.HasEmails = false;
                    Incident.HasNotifications = false;
                    Incident.HasRelatedItems = false;
                    Incident.HasWorkLog = false;
                    //Incident.LastUpdated = 0;
                    Incident.LastUpdatedById = 1;
                    Incident.LastUpdatedDateTime = System.DateTime.Now;
                    Incident.Name = "CertCenterDataService.returnDataSet Error";
                    Incident.PercentComplete = 0;
                    Incident.PriorityTypeId = 4;
                    Incident.ProjectId = OnTimeProjId;
                    Incident.PubliclyViewable = false;
                    Incident.ReplicationProcedures = null;
                    Incident.ReportedByCustomerContactId = 0;
                    Incident.ReportedById = 1;
                    Incident.ReportedDate = System.DateTime.Now;
                    Incident.SeverityTypeId = 1;
                    Incident.StartDate = System.DateTime.Now;
                    Incident.StatusTypeId = 1;
                    Incident.WorkflowStepId = 31;
                    Incident.Notes = "SQL String = " + strSQL;



                    int intReturn = iHandler.AddIncident(TOKEN, Incident, null);
                    throw;
                }
                finally
                {
                    da.Dispose();
                    conn.Close();
                }
                return ds;
            }

    }

     

    This is the runtime error I get:

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> There is an error in XML document (1, 347). ---> Format of the initialization string does not conform to specification starting at index 0.
      at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
      at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
      at OntimeIncidentService.IncidentHandler.AddIncident(Guid securityToken, Incident incident, CustomFieldValue[] customValues) in c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\certcenterdataservice\69e3f2f1\dffa5f68\App_WebReferences.jld23sv7.0.cs:line 133
      at CertCenterDataService.DataService.returnDataSet(String strSQL, SqlConnection conn) in c:\Inetpub\wwwroot\CertCenterDataService\App_Code\CertCenterDataService.asmx.cs:line 184
      at CertCenterDataService.DataService.GetSelectCerts(Int32 SearchId) in c:\Inetpub\wwwroot\CertCenterDataService\App_Code\CertCenterDataService.asmx.cs:line 526

    Filed under: , ,
View Complete Thread

© 2002 - 2007, Axosoft, LLC. All Rights Reserved. | Privacy
Bug Tracking | Defect Tracking Videos | Help Desk Software