📄 default.aspx.cs
字号:
{
//DHT_Delever_RecvMsg(s, sSrc_Number);//处理接收的短信类型
//int nCount = GetListItemCount();
//this.listBox_Send.Items.Insert(nCount, s);
}
else
{
}
}
}
else if (header.Command_Id == CMPP_Command_Id.CMPP_QUERY_RESP)
{
CMPP_QUERY_RESP reponse = new CMPP_QUERY_RESP(bytes);
s = reponse.ToString();
}
else if (header.Command_Id == CMPP_Command_Id.CMPP_SUBMIT_RESP)
{
CMPP_SUBMIT_RESP response = new CMPP_SUBMIT_RESP(bytes);
s = response.ToString();
}
else if (header.Command_Id == CMPP_Command_Id.CMPP_TERMINATE_RESP)
{
s = String.Format("good bye");
}
//Console.WriteLine(s + "\n");
}
private void c_RequestMessageSend(Client Sender, MessageEventArgs e)
{
//Console.WriteLine("Send {0} Request!",e.Header.Command_Id);
}
public bool Is_Number(string s)
{
s.Trim();
int Flag = 0;
char[] str = s.ToCharArray();
for (int i = 0; i < str.Length; i++)
{
if (Char.IsNumber(str[i]))
{
Flag++;
}
else
{
Flag = -1;
break;
}
}
if (Flag > 0)
{
return true;//数字
}
else
{
return false;//非数字
}
}
/// <summary>
/// 反向订购接口
/// </summary>
/// <remarks>
/// 该消息编号:TransactionID
/// 版本:Version
/// 消息类型:MsgType
/// 发送方设备类型:Send_Address_DeviceType
/// 发送方设备编号:Send_Address_DeviceID
/// 接收方设备类型:Dest_Address_DeviceType
/// 接收方设备编号:Dest_Address_DeviceID
/// 计费用户类别:FeeUser_ID_UserIDType
/// ■计费用户手机:FeeUser_ID_MSISDN
/// 使用用户类别:DestUser_ID_UserIDType
/// ■使用用户手机:DestUser_ID_MSISDN
/// 服务标识类别:ServiceIDType
/// SP的企业代码:SPID
/// SP的服务代码:SPServiceID
/// </remarks>
/// <param name="provisionInfo"></param>
/// <returns>MISC接口返回的hRet值(0成功,其它参考MISC相关文档)</returns>
public int SubscribeServiceReq(ProvisionInfo myPro)
{
//返回值
int result = 1;
StringBuilder xml = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
xml.Append("<SOAP-ENV:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\">");
xml.Append("<SOAP-ENV:Header>");
xml.Append("<TransactionID xmlns=\"http://www.monternet.com/dsmp/schemas/\">\" + myPro.TransactionID + \"</TransactionID>");//月+日+分+秒+毫秒
xml.Append("</SOAP-ENV:Header>");
xml.Append("<SOAP-ENV:Body>");
xml.Append("<SubscribeServiceReq xmlns=\"http://www.monternet.com/dsmp/schemas/\">");
xml.Append("<Version>" + myPro.Version + "</Version>");//1.5.0
xml.Append("<MsgType>" + myPro.MsgType + "</MsgType>");//SubscribeServiceReq
xml.Append("<Send_Address>");
xml.Append("<DeviceType>" + myPro.Send_Address_DeviceType.ToString() + "</DeviceType>");
xml.Append("<DeviceID>" + myPro.Send_Address_DeviceID + "</DeviceID>");//web.config
xml.Append("</Send_Address>");
xml.Append("<Dest_Address>");
xml.Append("<DeviceType>" + myPro.Dest_Address_DeviceType.ToString() + "</DeviceType> ");//0
xml.Append("<DeviceID>" + myPro.Dest_Address_DeviceID + "</DeviceID>");//web.config
xml.Append("</Dest_Address>");
xml.Append("<FeeUser_ID>");
xml.Append("<UserIDType>" + myPro.FeeUser_ID_UserIDType.ToString() + "</UserIDType>");//1
xml.Append("<MSISDN>" + myPro.FeeUser_ID_MSISDN + "</MSISDN>");
xml.Append("<PseudoCode />");
xml.Append("</FeeUser_ID>");
xml.Append("<DestUser_ID>");
xml.Append("<UserIDType>" + myPro.DestUser_ID_UserIDType.ToString() + "</UserIDType>");//1
xml.Append("<MSISDN>" + myPro.DestUser_ID_MSISDN + "</MSISDN>");
xml.Append("<PseudoCode />");
xml.Append("</DestUser_ID>");
xml.Append("<Service_ID>");
xml.Append("<ServiceIDType>" + myPro.ServiceIDType.ToString() + "</ServiceIDType>");//1
xml.Append("<SPID>" + myPro.SPID + "</SPID>");//web.config
xml.Append("<SPServiceID>" + myPro.SPServiceID + "</SPServiceID>");//web.config
xml.Append("<AccessNo />");
xml.Append("<FeatureStr />");
xml.Append("</Service_ID>");
xml.Append("<FeatureStr />");
xml.Append("</SubscribeServiceReq>");
xml.Append("</SOAP-ENV:Body>");
xml.Append("</SOAP-ENV:Envelope>");
byte[] postData = System.Text.Encoding.UTF8.GetBytes(xml.ToString());
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(SuburiReq);
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = postData.Length;
Stream newStream = myRequest.GetRequestStream();
//向反向订购接口发送数据
newStream.Write(postData, 0, postData.Length);
newStream.Close();
//获取反向订购接口返回的结果
XmlDocument doc = new XmlDocument();
WebResponse response = myRequest.GetResponse();
System.IO.Stream resStream = response.GetResponseStream();
if (resStream != null)
{
doc.Load(resStream);
}
resStream.Close();
//获取节点值
XmlElement root = doc.DocumentElement;
foreach (XmlNode node in root.ChildNodes[1].ChildNodes[0])//遍历SubscribeServiceResp节点
{
if (node.Name == "hRet")
{
result = int.Parse(node.InnerText);
}
}
//System.IO.StreamReader sr = new System.IO.StreamReader(resStream, System.Text.Encoding.UTF8))
//string s = sr.ReadToEnd();
//sr.Close();
return result;
}
/// <summary>
/// 反向取消接口
/// </summary>
/// <remarks>
/// 该消息编号:TransactionID
/// 版本:Version
/// 消息类型:MsgType
/// 发送方设备类型:Send_Address_DeviceType
/// 发送方设备编号:Send_Address_DeviceID
/// 接收方设备类型:Dest_Address_DeviceType
/// 接收方设备编号:Dest_Address_DeviceID
/// 计费用户类别:FeeUser_ID_UserIDType
/// ■计费用户手机:FeeUser_ID_MSISDN
/// 使用用户类别:DestUser_ID_UserIDType
/// ■使用用户手机:DestUser_ID_MSISDN
/// 服务标识类别:ServiceIDType
/// SP的企业代码:SPID
/// SP的服务代码:SPServiceID
///
/// </remarks>
/// <param name="provisionInfo">瘦客户对象</param>
/// <returns>MISC接口返回的hRet值(0成功,其它参考MISC相关文档)</returns>
public int UnSubscribeServiceReq(ProvisionInfo myPro)
{
//返回值
int result = 1;
StringBuilder xml = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
xml.Append("<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns=\"http://www.monternet.com/dsmp/schemas/\">");
xml.Append("<SOAP-ENV:Header>");
xml.Append("<TransactionID xmlns=\"http://www.monternet.com/dsmp/schemas/\" xsi:type=\"xsd:string\">" + myPro.TransactionID + "</TransactionID>");//月+日+分+秒+毫秒
xml.Append("</SOAP-ENV:Header>");
xml.Append("<SOAP-ENV:Body>");
xml.Append("<UnSubscribeServiceReq xmlns=\"http://www.monternet.com/dsmp/schemas/\">");
xml.Append("<Version>" + myPro.Version + "</Version>");//1.5.0
xml.Append("<MsgType>" + myPro.MsgType + "</MsgType>");//SubscribeServiceReq
xml.Append("<Send_Address>");
xml.Append("<DeviceType>" + myPro.Send_Address_DeviceType.ToString() + "</DeviceType>");
xml.Append("<DeviceID>" + myPro.Send_Address_DeviceID + "</DeviceID>");//web.config
xml.Append("</Send_Address>");
xml.Append("<Dest_Address>");
xml.Append("<DeviceType>" + myPro.Dest_Address_DeviceType.ToString() + "</DeviceType>");//0
xml.Append("<DeviceID>" + myPro.Dest_Address_DeviceID + "</DeviceID>");//web.config
xml.Append( "</Dest_Address>");
xml.Append("<FeeUser_ID>");
xml.Append("<UserIDType>" + myPro.FeeUser_ID_UserIDType.ToString() + "</UserIDType>");//1
xml.Append("<MSISDN>" + myPro.FeeUser_ID_MSISDN + "</MSISDN>");
xml.Append("<PseudoCode />");
xml.Append("</FeeUser_ID>");
xml.Append("<DestUser_ID>");
xml.Append("<UserIDType>" + myPro.DestUser_ID_UserIDType.ToString() + "</UserIDType>");//1
xml.Append("<MSISDN>" + myPro.DestUser_ID_MSISDN + "</MSISDN>");
xml.Append("<PseudoCode />");
xml.Append("</DestUser_ID>");
xml.Append("<Service_ID>");
xml.Append("<ServiceIDType>" + myPro.ServiceIDType.ToString() + "</ServiceIDType>");//1
xml.Append("<SPID>" + myPro.SPID + "</SPID>");//web.config
xml.Append("<SPServiceID>" + myPro.SPServiceID + "</SPServiceID>");//web.config
xml.Append("<AccessNo />");
xml.Append("<FeatureStr />");
xml.Append("</Service_ID>");
xml.Append("<FeatureStr />");
xml.Append("</UnSubscribeServiceReq>");
xml.Append("</SOAP-ENV:Body>");
xml.Append("</SOAP-ENV:Envelope>");
byte[] postData = System.Text.Encoding.UTF8.GetBytes(xml.ToString());
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(SuburiReq);
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = postData.Length;
Stream newStream = myRequest.GetRequestStream();
//向反向订购接口发送数据
newStream.Write(postData, 0, postData.Length);
newStream.Close();
//获取反向订购接口返回的结果
XmlDocument doc = new XmlDocument();
WebResponse response = myRequest.GetResponse();
System.IO.Stream resStream = response.GetResponseStream();
if (resStream != null)
{
doc.Load(resStream);
}
resStream.Close();
//获取节点值
XmlElement root = doc.DocumentElement;
foreach (XmlNode node in root.ChildNodes[1].ChildNodes[0])//遍历SubscribeServiceResp节点
{
if (node.Name == "hRet")
{
result = int.Parse(node.InnerText);
}
}
//System.IO.StreamReader sr = new System.IO.StreamReader(resStream, System.Text.Encoding.UTF8))
//string s = sr.ReadToEnd();
//sr.Close();
return result;
}
protected void Button1_Click(object sender, EventArgs e)//反向定制
{
ProvisionInfo inputproinfo = null;
inputproinfo.Version = this.Text1.Value.Trim();
inputproinfo.MsgType = this.Text2.Value.Trim();
inputproinfo.Send_Address_DeviceType = Convert.ToInt32(this.Text3.Value.Trim());
inputproinfo.Send_Address_DeviceID = this.Text4.Value.Trim();
inputproinfo.Dest_Address_DeviceType = Convert.ToInt32(this.Text5.Value.Trim());
inputproinfo.Dest_Address_DeviceID = this.Text7.Value.Trim();
inputproinfo.FeeUser_ID_UserIDType = Convert.ToInt32(this.Text6.Value.Trim());
inputproinfo.FeeUser_ID_MSISDN = this.Text8.Value.Trim();
inputproinfo.DestUser_ID_UserIDType = Convert.ToInt32(this.Text9.Value.Trim());
inputproinfo.DestUser_ID_MSISDN = this.Text10.Value.Trim();
inputproinfo.ServiceIDType = Convert.ToInt32(this.Text11.Value.Trim());
inputproinfo.SPID = this.Text12.Value.Trim();
inputproinfo.SPServiceID = this.Text13.Value.Trim();
this.SubscribeServiceReq(inputproinfo);
}
protected void Button2_Click(object sender, EventArgs e)//反向取消
{
ProvisionInfo inputproinfo = null;
inputproinfo.Version = this.Text1.Value.Trim();
inputproinfo.MsgType = this.Text2.Value.Trim();
inputproinfo.Send_Address_DeviceType = Convert.ToInt32(this.Text3.Value.Trim());
inputproinfo.Send_Address_DeviceID = this.Text4.Value.Trim();
inputproinfo.Dest_Address_DeviceType = Convert.ToInt32(this.Text5.Value.Trim());
inputproinfo.Dest_Address_DeviceID = this.Text7.Value.Trim();
inputproinfo.FeeUser_ID_UserIDType = Convert.ToInt32(this.Text6.Value.Trim());
inputproinfo.FeeUser_ID_MSISDN = this.Text8.Value.Trim();
inputproinfo.DestUser_ID_UserIDType = Convert.ToInt32(this.Text9.Value.Trim());
inputproinfo.DestUser_ID_MSISDN = this.Text10.Value.Trim();
inputproinfo.ServiceIDType = Convert.ToInt32(this.Text11.Value.Trim());
inputproinfo.SPID = this.Text12.Value.Trim();
inputproinfo.SPServiceID = this.Text13.Value.Trim();
this.UnSubscribeServiceReq(inputproinfo);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -