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 InitializeMfp(string myUrl) { E_EVENT_ID_TYPE event_type = E_EVENT_ID_TYPE.ON_JOB_COMPLETED; ACCESS_POINT_TYPE sink_url = new ACCESS_POINT_TYPE(); sink_url.URLType = E_ADDRESSPOINT_TYPE.SOAP; sink_url.Value = myUrl; MFPCoreWSEx mfpWS = GetConfiguredMfpCoreWS(); mfpWS.Subscribe(null, event_type, sink_url, true); }
/// <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); }