Пример #1
0
        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());
                }
            }
        }
Пример #2
0
 protected abstract void onMessage(MoSmsReq moSmsReq);