Welcome to the Axosoft Community, Sign in | Register | Help
in Search

Creating Incidents with the SDK

Last post 08-08-2007, 1:23 PM by JFaria. 2 replies.
Sort Posts: Previous Next
  •  08-07-2007, 5:33 AM 12704

    Creating Incidents with the SDK

    I wonder if anyone has some example code to create an incident using the SDK. I've been able to read everything and create defects and features but I have had no luck with creating incidents. I get a very long message about a mal-formed XML documents from the web service. I'm sure I'm just missing something simple.

     

     Thanks in advance

    Filed under: ,
  •  08-08-2007, 10:38 AM 12736 in reply to 12704

    Re: Creating Incidents with the SDK

    Hello JFaria,

    I don't have any sample code at this time, but I wonder if you've seen the SDK sample video and the examples that come with the SDK? 

    You've probably already seen these, but I'll link to them just in case you haven't:

    Sample video: http://www.axosoft.com/Videos/OT2005SDK/SimpleExample.htm

    .Zip file which included many various SDK examples: http://www.axosoft.com/downloads/OnTime2007SdkSetup.zip


     


    Thank you,

    Tom Harder
    Axosoft Support
    support@axosoft.com
    1.800.653.0024 option 3
    --'Fear the Bug' Podcast--
  •  08-08-2007, 1:23 PM 12741 in reply to 12736

    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 as RSS news feed in XML

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