Hi,
I used the code : https://apiforums.easylink.com/system/files/CS_JobSubmit_SMS_Single_2.5.txt
i get an error saying error in parsing. where am i going wrong?
//JobSubmitRequest SMS Options
// setup EMsgAPI object - EM
ELJobSubmitWS.JobSubmitService EM = new ELJobSubmitWS.JobSubmitService();
// setup Authentication objects
ELJobSubmitWS.RequestAuthentication reqAuth = new ELJobSubmitWS.RequestAuthentication();
ELJobSubmitWS.XDDSAuthType XDDSAuth = new ELJobSubmitWS.XDDSAuthType();
ELJobSubmitWS.UIDType uid = new ELJobSubmitWS.UIDType();
// init Authentication objects
XDDSAuth.Password = pwd; //string obj
uid.Value = id; //string id
XDDSAuth.RequesterID = uid;
reqAuth.Item = XDDSAuth;
// Setup MessageObject
ELJobSubmitWS.MessageType[] JS_Message = new ELJobSubmitWS.MessageType[1];
JS_Message[0] = new ELJobSubmitWS.MessageType();
// Setup JobOptions - Voice and CRef
ELJobSubmitWS.JobOptionsType JS_JobOptions = new ELJobSubmitWS.JobOptionsType();
ELJobSubmitWS.EncodableStringType JS_CRef = new ELJobSubmitWS.EncodableStringType();
ELJobSubmitWS.SmsOptionsType JS_SMSOptions = new ELJobSubmitWS.SmsOptionsType();
// set CREF and Billing Code
JS_CRef.Value = "SMS from Premiere Connect";
JS_JobOptions.CustomerReference = JS_CRef;
// Set SMS Options
//JS_SMSOptions.ExpirationDaysSpecified = false;
// 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;
// Setup Documents
ELJobSubmitWS.DocumentType[] JS_Documents = new ELJobSubmitWS.DocumentType[1];
JS_Documents[0] = new ELJobSubmitWS.DocumentType();
// Setup reusable variables for the document
ELJobSubmitWS.DocDataType DocData = new ELJobSubmitWS.DocDataType();
DocData.format = ELJobSubmitWS.DocEncodingFormat.text;
DocData.Value = "hi123";
// Setup Document 1 - Text to be delivered to SMS Device
JS_Documents[0].Item = DocData;
ELJobSubmitWS.EncodableStringType myFileName = new ELJobSubmitWS.EncodableStringType();
myFileName.Value = filename12; //string file destination name
JS_Documents[0].Filename = myFileName;
JS_Documents[0].DocType = "text";
JS_Documents[0].ItemElementName = ELJobSubmitWS.ItemChoiceType.DocData;
JS_Documents[0].@ref = "TextMessage";
DocData = null;
// Setup Content
ELJobSubmitWS.ContentsType EM_Content = new ELJobSubmitWS.ContentsType();
EM_Content = new ELJobSubmitWS.ContentsType();
ELJobSubmitWS.ContentPartType[] JS_Content = new ELJobSubmitWS.ContentPartType[1];
JS_Content[0] = new ELJobSubmitWS.ContentPartType();
JS_Content[0].Item = "TextMessage";
JS_Content[0].Treatment = ELJobSubmitWS.TreatmentType.body;
JS_Content[0].TreatmentSpecified = true;
// Setup Destination
ELJobSubmitWS.SmsType[] delivery = new ELJobSubmitWS.SmsType[1];
delivery[0] = new ELJobSubmitWS.SmsType();
delivery[0].Phone = mynumber; //string phone number
delivery[0].@ref = "Phone Number Entered";
// Setup Report Options
ELJobSubmitWS.ReportOptionsType JS_Report = new ELJobSubmitWS.ReportOptionsType();
ELJobSubmitWS.ReportOptionsTypeDeliveryReport DeliveryReport = new ELJobSubmitWS.ReportOptionsTypeDeliveryReport();
DeliveryReport.DeliveryReportType = ELJobSubmitWS.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].Destinations = delivery;
JS_Message[0].MessageId = System.Environment.MachineName + DateTime.Now;
JS_Content = null;
// Setup Request and JobSubmitRequest object
ELJobSubmitWS.Request Request = new ELJobSubmitWS.Request();
ELJobSubmitWS.Response Response = new ELJobSubmitWS.Response();
ELJobSubmitWS.JobSubmitRequest JS_Request = new ELJobSubmitWS.JobSubmitRequest();
ELJobSubmitWS.JobSubmitResult JS_Result = new ELJobSubmitWS.JobSubmitResult();
// Everything is Setup Prepare to Launch Job
// First check to see if we need to setup proxy
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 = folder + "emresponse.xml";
string resfilename = folder + "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
serializeResult(emfilename, EM.ResponseValue);
serializeResult(resfilename, JS_Result);
//serializeResult(reqfilename, JS_Request);
}
catch (IOException io_error)
{
Console.WriteLine("Error - " + io_error, "Error");
}