public void ExecuteTest()
        {
            string xmlData  = @"<xml><ToUserName><![CDATA[gh_2fcf9662217c]]></ToUserName>
                    <FromUserName><![CDATA[oUwuTsws5bKe6sdNn-a3CC6LKSJk]]></FromUserName>
                    <CreateTime>1506698017</CreateTime>
                    <MsgType><![CDATA[text]]></MsgType>
                    <Content><![CDATA[来来来]]></Content>
                    <MsgId>6471218708403765285</MsgId>
                    </xml>";
            var    dispatch = new WeixinMsgProcess();
            var    xml      = dispatch.Execute(xmlData);

            Assert.Fail();
        }
Esempio n. 2
0
        public void IndexPost()
        {
            string postStr;

            using (Stream stream = HttpContext.Request.InputStream)
            {
                Byte[] postBytes = new Byte[stream.Length];
                stream.Read(postBytes, 0, (Int32)stream.Length);
                postStr = Encoding.UTF8.GetString(postBytes);
            }

            if (!string.IsNullOrEmpty(postStr))
            {
                Object data = new WeixinMsgProcess().Execute(postStr);

                var result = XmlWeiXinHelper.SerializeForWeiXin(data);
                Response.Write(result);
            }
        }