private void JobSubmitRequestSMStoList_Click(object sender, EventArgs e) { //SMS to list // setup EMsgAPI object - EM EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitService EM = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitService(); // setup Authentication objects EMsgAPI_JobSubmit201101.RequestAuthentication reqAuth = new EMsgAPI_JobSubmit201101.RequestAuthentication(); EMsgAPI_JobSubmit201101.XDDSAuthType XDDSAuth = new EMsgAPI_JobSubmit201101.XDDSAuthType(); EMsgAPI_JobSubmit201101.UIDType uid = new EMsgAPI_JobSubmit201101.UIDType(); // init Authentication objects XDDSAuth.Password = txtAccessCode.Text; uid.Value = txtUserId.Text; XDDSAuth.RequesterID = uid; reqAuth.Item = XDDSAuth; // Setup MessageObject EMsgAPI_Demo.EMsgAPI_JobSubmit201101.MessageType[] JS_Message = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.MessageType[1]; JS_Message[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.MessageType(); // Setup JobOptions - CREF, Billing Code, FAX EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobOptionsType JS_JobOptions = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobOptionsType(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.EncodableStringType JS_CRef = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.EncodableStringType(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.EncodableStringType JS_BCode = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.EncodableStringType(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.SmsOptionsType JS_SMSOptions = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.SmsOptionsType(); // set CREF and Billing Code if (txtBC.Text.Length > 0) { JS_BCode.Value = txtBC.Text; JS_JobOptions.BillingCode = JS_BCode; } // BC if (txtCRef.Text.Length > 0) { JS_CRef.Value = txtCRef.Text; JS_JobOptions.CustomerReference = JS_CRef; } // CRef // Set JobOptions as SMSOptions JS_JobOptions.SmsOptions = JS_SMSOptions; // Set Message Object JS_Message[0].JobOptions = JS_JobOptions; // Free Objects JS_JobOptions = null; JS_SMSOptions = null; JS_CRef = null; JS_BCode = null; // Setup Documents EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocumentType[] JS_Documents = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocumentType[2]; JS_Documents[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocumentType(); // Setup reusable variables for the document EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocDataType DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocDataType(); // Setup Document 1 - PDF DocData.format = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocEncodingFormat.text; DocData.Value = txtSMSMessage.Text; JS_Documents[0].Item = DocData; EMsgAPI_Demo.EMsgAPI_JobSubmit201101.EncodableStringType myFileName = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.EncodableStringType(); myFileName.Value = "txtmessage.txt"; JS_Documents[0].Filename = myFileName; JS_Documents[0].DocType = "text"; JS_Documents[0].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ItemChoiceType.DocData; JS_Documents[0].@ref = "textmessage"; DocData = null; if (UseCSVList.Checked == true) { string File; // Setup Document 2 - CSV List DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocDataType(); File = ReadAndEncodedFile(txtCSVList.Text, true); DocData.format = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocEncodingFormat.base64; DocData.Value = File; JS_Documents[1] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocumentType(); JS_Documents[1].Item = DocData; myFileName.Value = "CSVList.csv"; JS_Documents[1].Filename = myFileName; JS_Documents[1].DocType = "text"; JS_Documents[1].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ItemChoiceType.DocData; JS_Documents[1].@ref = "CSVList1"; DocData = null; } // (UseCSVList.Checked == true) // Setup Content EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentsType EM_Content = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentsType(); EM_Content = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentsType(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentPartType[] JS_Content = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentPartType[1]; JS_Content[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentPartType(); // Setup references to documents JS_Content[0].Item = "textmessage"; JS_Content[0].Treatment = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.TreatmentType.body; JS_Content[0].TreatmentSpecified = true; if (UseCSVList.Checked == true) // Pass in a CSV List with Job Submit { // Setup table for list // List was loaded in document section must be added as a Table in Content Section EMsgAPI_Demo.EMsgAPI_JobSubmit201101.TableType[] CSVList_Table = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.TableType[1]; CSVList_Table[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.TableType(); CSVList_Table[0].Item = "CSVList1"; CSVList_Table[0].@ref = "CSVList_Table1"; JS_Message[0].Destinations = CSVList_Table; CSVList_Table = null; } else // Use a previously stored list { // Setup List Object EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ListType[] lists = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ListType[1]; lists[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ListType(); lists[0].ownershipLevel = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.OwnershipLevelType.customer; lists[0].ownershipLevelSpecified = true; lists[0].Name = txtStoredList.Text; // Name of stored list lists[0].@ref = "Stored Fax List"; JS_Message[0].Destinations = lists; lists = null; } // Setup Report Options EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ReportOptionsType JS_Report = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ReportOptionsType(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ReportOptionsTypeDeliveryReport DeliveryReport = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ReportOptionsTypeDeliveryReport(); DeliveryReport.DeliveryReportType = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.MainReportTypeEnum.none; JS_Report.DeliveryReport = DeliveryReport; JS_Message[0].Reports = JS_Report; EM_Content.Part = JS_Content; JS_Message[0].Contents = EM_Content; JS_Message[0].MessageId = System.Environment.MachineName + DateTime.Now; JS_Content = null; // Everything is Setup Prepare to Launch Job // Setup Request and JobSubmitRequest object EMsgAPI_Demo.EMsgAPI_JobSubmit201101.Request Request = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.Request(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.Response Response = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.Response(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitRequest JS_Request = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitRequest(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitResult JS_Result = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitResult(); // Setup Proxy server and EMsgAPIConnect URL for posting data Set_Server_and_Proxy(EM); // Setup Reqeust Object Request.ReceiverKey = EM.Url; Request.Authentication = reqAuth; // Assign Reqeust and Response objects to EM Object EM.RequestValue = Request; EM.ResponseValue = Response; JS_Request.Message = JS_Message; JS_Request.DocumentSet = JS_Documents; try { JS_Result = EM.JobSubmit(JS_Request); } catch (Exception ex) { System.Console.WriteLine(ex.Message); System.Console.Read(); return; } if (JS_Result.Status.StatusCode != null) { string JobNumber; JobNumber = JS_Result.MessageResult[0].JobId.XDN + ":" + JS_Result.MessageResult[0].JobId.MRN; txtJobNumber.Text = JobNumber; } string emfilename = "emresponse.xml"; string resfilename = "result.xml"; //string reqfilename = "request.xml"; try { //This will output the response, result and request(if uncommented) to XML files in the //installed directory. This can be very usefull for debugging or ir help is requested from //the EMAPI support team if (chkResult) { serializeResult(emfilename, EM.ResponseValue); serializeResult(resfilename, JS_Result); //serializeResult(reqfilename, JS_Request); } } catch (IOException io_error) { MessageBox.Show("Error - " + io_error, "Error", MessageBoxButtons.OK); } }