private void SubscribeToExitEvent() { if (_ws == null) { try { CreateWS(); ACCESS_POINT_TYPE aType = new ACCESS_POINT_TYPE(); aType.URLType = E_ADDRESSPOINT_TYPE.SOAP; string sLocalAddrs = @Request.Params["LOCAL_ADDR"].ToString(); string sRequestCurAppPath = Request.ApplicationPath; if (String.Compare(WebConfigurationManager.AppSettings["UseSSL"].ToString(), "true", true, CultureInfo.CurrentCulture) == 0) { aType.Value = @"https://"; } else { aType.Value = @"http://"; } aType.Value = aType.Value + @sLocalAddrs + @sRequestCurAppPath + @"/MFPSink.asmx"; OSA_JOB_ID_TYPE type = null; _ws.Subscribe(type, E_EVENT_ID_TYPE.ON_MODE_EXITED, aType, true, ref OsaDirectManager.Core.g_WSDLGeneric); } catch (SoapException e) { } } }
public void Subscribe(OSA_JOB_ID_TYPE jid, E_EVENT_ID_TYPE eType, ACCESS_POINT_TYPE sinkURL, bool action) { try { base.Subscribe(jid, eType, sinkURL, action, ref wsdlGeneric); } catch (Exception) { throw; } }
public void SetJobElements(OSA_JOB_ID_TYPE jid, XML_DOC_SET_TYPE set) { base.SetJobElements(jid, set, ref wsdlGeneric); }
public void CloseJob(OSA_JOB_ID_TYPE jid) { base.CloseJob(jid, ref wsdlGeneric); }
public void CancelJob(OSA_JOB_ID_TYPE jid) { base.CancelJob(jid, ref wsdlGeneric); }
public JOB_STATUS_TYPE GetJobStatus(OSA_JOB_ID_TYPE jid) { return(base.GetJobStatus(jid, ref wsdlGeneric)); }
public void ExecuteJob(OSA_JOB_ID_TYPE jid) { base.ExecuteJob(jid, ref wsdlGeneric); }
/// <summary> /// Runs the WS calls. /// </summary> /// <returns>string</returns> /// <remarks> /// Sequence Diagram:<br/> /// <img src="SequenceDiagrams/SD_PrintReleaseDevice.Browser.PrintJobs.RunWSCalls.jpg"/> /// </remarks> private string RunWSCalls() { string returnValue = string.Empty; try { Hashtable htPrintFiles = new Hashtable(); htPrintFiles.Add(0, Session["__SelectedFiles"] as string); Session["PrintFiles"] = htPrintFiles; // retrieve UISessionId from header sent from MFP string sessionID = Request.QueryString["UISessionId"].ToString(); Session["UISESSIONID"] = sessionID; bool isWsCreated = CreateWS(); //subscribe data ACCESS_POINT_TYPE aType = new ACCESS_POINT_TYPE(); aType.URLType = E_ADDRESSPOINT_TYPE.SOAP; string sLocalAddrs = @Request.Params["LOCAL_ADDR"].ToString(); string sRequestCurAppPath = Request.ApplicationPath; if (String.Compare(WebConfigurationManager.AppSettings["UseSSL"].ToString(), "true", true, CultureInfo.CurrentCulture) == 0) { aType.Value = @"https://"; } else { aType.Value = @"http://"; } aType.Value = aType.Value + @sLocalAddrs + @sRequestCurAppPath + @"/MFPEventsCapture.asmx"; if (isWsCreated) { // create a new Print job string printedFiles = Session["__SelectedFiles"] as string; string printJobIDs = string.Empty; Dictionary <string, OSA_JOB_ID_TYPE> jobStatus = new Dictionary <string, OSA_JOB_ID_TYPE>(); if (!string.IsNullOrEmpty(printedFiles)) { string[] printedFileList = printedFiles.Split(",".ToCharArray()); for (int fileIndex = 0; fileIndex < printedFileList.Length; fileIndex++) { string currentPrintFile = printedFileList[fileIndex].Trim(); try { OSA_JOB_ID_TYPE currentJobID = (OSA_JOB_ID_TYPE)mfpWebService.CreateJob(E_MFP_JOB_TYPE.PRINT, Session["UISESSIONID"].ToString(), ref OsaDirectManager.Core.g_WSDLGeneric); printJobIDs += (OSA_JOB_ID_TYPE)currentJobID; XML_DOC_SET_TYPE setData = (XML_DOC_SET_TYPE)Session["XML_DOC_SET_TYPE"]; if (setData != null && IsJobCreated()) { string urlPath = ProvideFilePath(currentPrintFile); OsaDirectManager.Core.SetThePropValueInXMLDOCSETType(ref setData, "delivery-info", "file-name", "unknown.prn"); OsaDirectManager.Core.SetThePropValueInXMLDOCSETType(ref setData, "http-destination", "url", urlPath); } Session["XML_DOC_SET_TYPE"] = (XML_DOC_SET_TYPE)setData; //populate the file ext Session["FILEEXT"] = OsaDirectManager.Core.GetFileExtension(setData); // set up all Print parameters specified above mfpWebService.SetJobElements(currentJobID, setData, ref OsaDirectManager.Core.g_WSDLGeneric); //subscribe for ON_HKEY_PRESSED event mfpWebService.Subscribe(currentJobID, E_EVENT_ID_TYPE.ON_HKEY_PRESSED, aType, true, ref OsaDirectManager.Core.g_WSDLGeneric); mfpWebService.ExecuteJob(currentJobID, ref OsaDirectManager.Core.g_WSDLGeneric); jobStatus.Add(currentPrintFile, currentJobID); } catch (SoapException soapEx) { DisplaySoapException(soapEx); break; } catch (Exception generalExp) { DisplayException(generalExp); break;; } } Session["deleteJobs"] = null; } if (!string.IsNullOrEmpty(printJobIDs)) { Session["CurrentJobIDs"] = jobStatus; } } else { DisplayMessage("Failed to create Webservice Object"); } } catch (Exception generalExp) { DisplayException(generalExp); } return(returnValue); }
/// <summary> /// Gets the job status. /// </summary> /// <param name="jobID">Job ID.</param> /// <param name="errorInfo">Error info.</param> /// <returns></returns> /// <remarks> /// Sequence Diagram:<br/> /// <img src="SequenceDiagrams/SD_PrintReleaseDevice.Mfp.JobStatus.GetJobStatus.jpg"/> /// </remarks> private string GetJobStatus(OSA_JOB_ID_TYPE jobID, out ERROR_TYPE[] errorInfo) { errorInfo = null; string returnValue = string.Empty; bool create = CreateWS(); if (create) { OSA_JOB_ID_TYPE jobIDType = new OSA_JOB_ID_TYPE(); jobIDType.jobtype = E_MFP_JOB_TYPE.PRINT; JOB_STATUS_TYPE jobStatus = null; try { jobStatus = mfpWebService.GetJobStatus(jobID, ref OsaDirectManager.Core.g_WSDLGeneric); } catch (Exception) { } returnValue = Convert.ToString(jobStatus.status); switch (jobStatus.status) { case E_JOB_STATUS_TYPE.QUEUED: { JOB_STATUS_DETAILS_QUEUED_TYPE details = jobStatus.details as JOB_STATUS_DETAILS_QUEUED_TYPE; // Process the details here // ... } errorInfo = null; returnValue = "Queued"; break; case E_JOB_STATUS_TYPE.FINISHED: { JOB_STATUS_DETAILS_FINISHED_TYPE details = jobStatus.details as JOB_STATUS_DETAILS_FINISHED_TYPE; // Process the details here // ... } errorInfo = null; returnValue = "Finished"; break; case E_JOB_STATUS_TYPE.CANCELED: { JOB_STATUS_DETAILS_CANCELED_TYPE details = jobStatus.details as JOB_STATUS_DETAILS_CANCELED_TYPE; } errorInfo = null; returnValue = "Cancelled"; break; case E_JOB_STATUS_TYPE.ERROR: { try { JOB_STATUS_DETAILS_ERROR_TYPE details = jobStatus.details as JOB_STATUS_DETAILS_ERROR_TYPE; ERROR_TYPE[] errors = details.errorList; errorInfo = errors; } catch (Exception ex) { // } } returnValue = "Error"; break; // ... other status types follow } } return(returnValue); }