protected override void onMessage(MoSmsReq moSmsReq) { MtSmsResp mtSmsResp = null; try { SmsSender smsSender = new SmsSender("http://127.0.0.1:7007/service"); List <String> address = new List <String>(); address.Add(moSmsReq.sourceAddress); MtSmsReq mtSmsReq = new MtSmsReq(); mtSmsReq.applicationId = moSmsReq.applicationID; mtSmsReq.password = "******"; mtSmsReq.destinationAddresses = address; mtSmsReq.message = "Message Received. Thanks you."; mtSmsResp = smsSender.sendSMSReq(mtSmsReq); } catch (SdpException ex) { Console.WriteLine(ex.StackTrace); } }
protected override void onMessage(MoSmsReq moSmsReq) { MtSmsResp mtSmsResp=null; try { SmsSender smsSender = new SmsSender("http://127.0.0.1:7007/service"); List<String> address = new List<String>(); address.Add(moSmsReq.sourceAddress); MtSmsReq mtSmsReq = new MtSmsReq(); mtSmsReq.applicationId = moSmsReq.applicationID; mtSmsReq.password = "******"; mtSmsReq.destinationAddresses = address; mtSmsReq.message = "Message Received. Thanks you."; mtSmsResp = smsSender.sendSMSReq(mtSmsReq); } catch (SdpException ex) { Console.WriteLine(ex.StackTrace); } }
public void ProcessRequest(HttpContext context) { MoSmsResp moSmsResp = null; string jsonString = ""; context.Response.ContentType = "application/json"; try { byte[] PostData = context.Request.BinaryRead(context.Request.ContentLength); jsonString = Encoding.UTF8.GetString(PostData); JavaScriptSerializer json_serializer = new JavaScriptSerializer(); MoSmsReq moSmsReq = json_serializer.Deserialize <MoSmsReq>(jsonString); moSmsResp = GenerateStatus(true); onMessage(moSmsReq); } catch (Exception) { moSmsResp = GenerateStatus(false); } finally { if (jsonString.Equals("")) { context.Response.Write(APPLICATION_RUNING_MESSAGE); } else { context.Response.Write(moSmsResp.ToString()); } } }
protected abstract void onMessage(MoSmsReq moSmsReq);