/* call CS_SERVICEREQUEST_PUB_Service : GET_SR_INFO * Output : op.X_GETSR_OUT_REC * call dictAddProperty() to add the individual property name, type, and value * for dynamic columns feature */ public Dictionary<string, string> LookupSRDetail(decimal incident_id, string incident_number, int _logIncidentId = 0 , int _logContactId = 0) { string request = ""; string response = ""; string logMessage, logNote; if (String.IsNullOrWhiteSpace(SRLookupURL) || String.IsNullOrWhiteSpace(SRServiceUsername) || String.IsNullOrWhiteSpace(SRServicePassword)) { throw new Exception("Provider's InitForSR not run."); } SR.CS_SERVICEREQUEST_PUB_Service client = EBSProxyFactory.GetSRServiceInstance(SRLookupURL, SRServiceUsername, SRServicePassword, SRServiceTimeout); SR.InputParameters3 ip = new SR.InputParameters3(); ip.P_API_VERSION = 1; ip.P_API_VERSIONSpecified = true; ip.P_INCIDENT_ID = incident_id; ip.P_INCIDENT_IDSpecified = true; ip.P_INCIDENT_NUMBER = incident_number; List<SR_LOOKUP_CONTACT> contacts = new List<SR_LOOKUP_CONTACT>(); ip.X_CONTACT = contacts.ToArray(); List<SR_LOOKUP_TASK> tasks = new List<SR_LOOKUP_TASK>(); ip.X_TASKS = tasks.ToArray(); SR.OutputParameters3 op = null; Stopwatch stopwatch = new Stopwatch(); try { request = serializer.Serialize(ip); logMessage = "Request of getting SR details (GET_SR_INFO). "; logNote = "Request Payload: " + request; log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote); // call the web service, catch the exception right away stopwatch.Start(); op = client.GET_SR_INFO(ip); stopwatch.Stop(); response = serializer.Serialize(op); } catch (Exception ex) { handleEBSException(ex, "GET_SR_INFO", _logIncidentId, _logContactId); // will throw the new exception (either timeout or error communicating ...) // b/c caller SRdetailVirtualTable GetRows expect reportRows, so need to throw it to show the msg box throw; } if (op.X_RETURN_STATUS == "S") { logMessage = "Response of getting SR details (GET_SR_INFO). "; logNote = "Response Payload: " + response; log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote, (int)stopwatch.ElapsedMilliseconds); } else { logMessage = "Response of getting SR details (GET_SR_INFO (Failure). " + op.X_MSG_DATA; logNote = "Response Payload: " + response; log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote); } Dictionary<string, string> dictDetail = new Dictionary<string, string>(); foreach (PropertyInfo propertyInfo in op.X_GETSR_OUT_REC.GetType().GetProperties()) { Object propVal = op.X_GETSR_OUT_REC.GetType().GetProperty(propertyInfo.Name).GetValue(op.X_GETSR_OUT_REC, null); dictAddProperty(propertyInfo, propVal, ref dictDetail); } return dictDetail; }
public ServiceRequest LookupSR(decimal incident_id, string incident_number, int _logIncidentId = 0, int _logContactId = 0) { if (String.IsNullOrWhiteSpace(SRLookupURL) || String.IsNullOrWhiteSpace(SRServiceUsername) || String.IsNullOrWhiteSpace(SRServicePassword)) { throw new Exception("Provider's InitForSR not run."); } SR.CS_SERVICEREQUEST_PUB_Service client = EBSProxyFactory.GetSRServiceInstance(SRLookupURL, SRServiceUsername, SRServicePassword, SRServiceTimeout); ServiceRequest result = new ServiceRequest(); string request = ""; string response = ""; string logMessage, logNote; SR.SOAHeader hdr = new SR.SOAHeader(); hdr.Responsibility = "SERVICE"; hdr.RespApplication = "CS"; hdr.Org_Id = "204"; hdr.SecurityGroup = "STANDARD"; hdr.NLSLanguage = "AMERICAN"; client.SOAHeaderValue = hdr; SR.InputParameters3 ip_get_sr = new SR.InputParameters3(); ip_get_sr.P_API_VERSION = 1; ip_get_sr.P_API_VERSIONSpecified = true; ip_get_sr.P_INCIDENT_ID = incident_id; ip_get_sr.P_INCIDENT_IDSpecified = true; ip_get_sr.P_INCIDENT_NUMBER = incident_number; List<SR_LOOKUP_CONTACT> contacts = new List<SR_LOOKUP_CONTACT>(); ip_get_sr.X_CONTACT = contacts.ToArray(); List<SR_LOOKUP_TASK> tasks = new List<SR_LOOKUP_TASK>(); ip_get_sr.X_TASKS = tasks.ToArray(); //ip.X_GETSR_OUT_REC = new SRL.APPSCS_SERVICEREQUEX16438971X1X2(); Stopwatch stopwatch = new Stopwatch(); try { request = serializer.Serialize(ip_get_sr); stopwatch.Start(); SR.OutputParameters3 op = client.GET_SR_INFO(ip_get_sr); stopwatch.Stop(); //response = client.ResponseSoapContext.Envelope.Envelope.InnerXml; response = serializer.Serialize(op); if (op.X_RETURN_STATUS == "S") { result.RequestID = op.X_GETSR_OUT_REC.INCIDENT_ID; result.RequestNumber = op.X_GETSR_OUT_REC.INCIDENT_NUMBER; result.IncidentID = op.X_GETSR_OUT_REC.EXTATTRIBUTE15; result.IncidentRef = op.X_GETSR_OUT_REC.EXTATTRIBUTE14; result.StatusID = op.X_GETSR_OUT_REC.INCIDENT_STATUS_ID; result.Status = op.X_GETSR_OUT_REC.INCIDENT_STATUS; result.SeverityID = op.X_GETSR_OUT_REC.INCIDENT_SEVERITY_ID; result.Severity = op.X_GETSR_OUT_REC.INCIDENT_SEVERITY; result.RequestTypeID = op.X_GETSR_OUT_REC.INCIDENT_TYPE_ID; result.RequestType = op.X_GETSR_OUT_REC.INCIDENT_TYPE; result.Summary = op.X_GETSR_OUT_REC.SUMMARY; result.SrObjVerNum = op.X_GETSR_OUT_REC.OBJECT_VERSION_NUMBER; result.SerialNumber = op.X_GETSR_OUT_REC.SERIAL_NUMBER; result.ProductID = op.X_GETSR_OUT_REC.CUSTOMER_PRODUCT_ID; result.Product = op.X_GETSR_OUT_REC.PRODUCT; result.ProductDescription = op.X_GETSR_OUT_REC.PRODUCT_DESCRIPTION; result.Owner = op.X_GETSR_OUT_REC.SR_OWNER; result.OwnerID = op.X_GETSR_OUT_REC.SR_OWNER_ID; logMessage = "Request of loading Service Request (Success). SR ID = " + incident_id; logNote = "Request Payload: " + request; log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote); logMessage = "Response of loading Service Request (Success). SR ID = " + incident_id; logNote = "Response Payload: " + response; log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote, (int)stopwatch.ElapsedMilliseconds); } else { result.ErrorMessage = "There has been an error communicating with EBS. Please check log for detail."; logMessage = "Request of loading Service Request (Failure). SR ID = " + incident_id + " Error: " + op.X_MSG_DATA; logNote = "Request Payload: " + request; log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote); logMessage = "Response of loading Service Request (Failure). SR ID = " + incident_id + " Error: " + op.X_MSG_DATA; logNote = "Response Payload: " + response; log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote); } } catch (Exception ex) { result.ErrorMessage = "There has been an error communicating with EBS. Please check log for detail."; logMessage = "Request of loading Service Request (Failure). SR ID = " + incident_id + " Error: " + ex.Message; logNote = "Request Payload: " + request; log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote); logMessage = "Response of loading Service Request (Failure). SR ID = " + incident_id + " Error: " + ex.Message; logNote = "Response Payload: " + response; log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote); handleEBSException(ex, "Lookup Service Request", _logIncidentId, _logContactId); } return result; }
/// <remarks/> public void GET_SR_INFOAsync(InputParameters3 InputParameters) { this.GET_SR_INFOAsync(InputParameters, null); }
/// <remarks/> public void GET_SR_INFOAsync(InputParameters3 InputParameters, object userState) { if ((this.GET_SR_INFOOperationCompleted == null)) { this.GET_SR_INFOOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGET_SR_INFOOperationCompleted); } this.InvokeAsync("GET_SR_INFO", new object[] { InputParameters}, this.GET_SR_INFOOperationCompleted, userState); }
/// <remarks/> public System.IAsyncResult BeginGET_SR_INFO(InputParameters3 InputParameters, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GET_SR_INFO", new object[] { InputParameters}, callback, asyncState); }