/// <remarks/>
 public void GET_INSTANCES_BY_ITEM_SERIALAsync(InputParameters2 InputParameters, object userState) {
     if ((this.GET_INSTANCES_BY_ITEM_SERIALOperationCompleted == null)) {
         this.GET_INSTANCES_BY_ITEM_SERIALOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGET_INSTANCES_BY_ITEM_SERIALOperationCompleted);
     }
     this.InvokeAsync("GET_INSTANCES_BY_ITEM_SERIAL", new object[] {
                 InputParameters}, this.GET_INSTANCES_BY_ITEM_SERIALOperationCompleted, userState);
 }
 /// <remarks/>
 public System.IAsyncResult BeginGET_INSTANCES_BY_ITEM_SERIAL(InputParameters2 InputParameters, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("GET_INSTANCES_BY_ITEM_SERIAL", new object[] {
                 InputParameters}, callback, asyncState);
 }
 /// <remarks/>
 public void GET_INSTANCES_BY_ITEM_SERIALAsync(InputParameters2 InputParameters) {
     this.GET_INSTANCES_BY_ITEM_SERIALAsync(InputParameters, null);
 }
        /// <summary>
        /// Returns EBS item instances for a given serial number and contact
        /// </summary>
        /// <param name="serial_number"></param>
        /// <param name="contact_org_id"></param>
        /// <param name="active_instance_only"></param>
        /// <param name="rntIncidentId"></param>
        /// <param name="rntContactId"></param>
        public Item[] LookupItemList (string serial_number, decimal contact_org_id, string active_instance_only,
            int rntIncidentId = 0, int rntContactId = 0)
        {
            Item[] retvals = new Item[0];
            string logMessage, logNote;
                //validate ebs service user and password
            if (String.IsNullOrWhiteSpace(ItemListURL) || String.IsNullOrWhiteSpace(ItemServiceUsername) || String.IsNullOrWhiteSpace(ItemServicePassword))
            {
                throw new Exception("Provider's InitForItem not run.");
            }
                //create ebs soap header
            ITEM.CSI_ITEM_INSTANCE_PUB_Service client = EBSProxyFactory.GetItemInstance(ItemListURL, ItemServiceUsername, ItemServicePassword, ItemServiceTimeout);
            ITEM.SOAHeader hdr = new ITEM.SOAHeader();
            hdr.Responsibility = "INSTALLED_BASE";
            hdr.RespApplication = "CSI";
            hdr.SecurityGroup = "STANDARD";
            hdr.NLSLanguage = "AMERICAN";
            hdr.Org_Id = "204";

            client.SOAHeaderValue = hdr;

                //create ebs soap request payload
            ITEM.InputParameters2 ip = new ITEM.InputParameters2();
            ip.P_API_VERSION = 1;
            ip.P_API_VERSIONSpecified = true;
            ip.P_COMMIT = "F";
            ip.P_INIT_MSG_LIST = "T";
            ip.P_VALIDATION_LEVEL = 1;
            ip.P_VALIDATION_LEVELSpecified = true;
            ip.P_RESOLVE_ID_COLUMNS = "T";
            ip.P_ACTIVE_INSTANCE_ONLY = active_instance_only;
                
                //log input parameters
            string parameters = String.Format("GET_INSTANCES_BY_ITEM_SERIAL for serial_number {0}, contact_org_id {1}",
                serial_number, contact_org_id.ToString());

            string error = "No valid parameters found. No search performed.";
            if (String.IsNullOrWhiteSpace(serial_number))
            {
                logMessage = parameters + ". " + error;
                logNote = null;
                ConfigurationSetting.logWrap.DebugLog(incidentId: rntIncidentId, contactId: rntContactId, logMessage: logMessage, logNote: logNote);
                return retvals;
            }
            else
            {
                ip.P_SERIAL_NUMBER = serial_number;
            }
            if (contact_org_id > 0)
            {
                ip.P_PARTY_ID = contact_org_id;
                ip.P_PARTY_IDSpecified = true;
                ip.P_PARTY_REL_TYPE_CODE = "OWNER";
            }
            else
            {
                logMessage = parameters + ". " + error;
                logNote = null;
                ConfigurationSetting.logWrap.DebugLog(incidentId: rntIncidentId, contactId: rntContactId, logMessage: logMessage, logNote: logNote);
                return retvals;
            }

            logMessage = parameters + ". Request payload.";
            logNote = serializer.Serialize(ip);
            ConfigurationSetting.logWrap.DebugLog(incidentId: rntIncidentId, contactId: rntContactId, logMessage: logMessage, logNote: logNote);
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();

                //invoke the ebs web service
            StringBuilder response = new StringBuilder("[{}");
            try
            {
                ITEM.OutputParameters2 opList = client.GET_INSTANCES_BY_ITEM_SERIAL(ip);               
                List<Item> items = new List<Item>();

                foreach (ITEM_LIST op in opList.X_INSTANCE_HEADER_TBL)
                {
                    Item item = new Item(getPropertyValues(op), serial_number, contact_org_id, active_instance_only);
                    items.Add(item);
                    response.Append(",").Append(item.ToJSON());
                }
                retvals = items.ToArray();
            }
            catch (Exception ex)
            {
                handleEBSException(ex, parameters, rntIncidentId, rntContactId);
                throw;
            }

            stopwatch.Stop();
            int timeElapsed = stopwatch.Elapsed.Milliseconds;
            logMessage = new StringBuilder(parameters)
                .Append(" returned ").Append(retvals.Count()).Append(" records in ")
                .Append(timeElapsed).Append("ms")
                .ToString(); logNote = response.Append(",{\"Count\":").Append("\"")
                .Append(retvals.Count()).Append("\"}]").ToString();
            ConfigurationSetting.logWrap.DebugLog(incidentId: rntIncidentId, contactId: rntContactId, logMessage: logMessage, logNote: logNote, timeElapsed: timeElapsed);
            return retvals;
        }