移动梦网MISC1.6正反向订购/取消
一、业务实体模型类
using System;
/// <summary>
/// 移动梦网 MISC 1.6 接口
/// 业务实体模型
/// create by hello world at 2006-11-29 (QQ:8935300)
/// </summary>
namespace Com.Rondi.MISC16
{
public class ProvisionInfo
{
public ProvisionInfo() { }
//消息类型
private string msgType;
//该消息编号
private string transactionID;
//该接口消息的版本号,本次所有的接口消息的版本都为“1.5.0”
private string version;
//Send_Address节点与Dest_Address节点
/*发送方:设备类型
0:MISC
100:ISMG
101:WAP SP PROXY
1XX:其他业务网关
200:WAP PORTAL
201:WWW PORTAL
202:VOICE PORTAL
203:PDA PORTAL
2XX:其他门户
300:MMSC
301:KJAVA SERVER
302:LSP
3XX:其它应用平台 */
private int send_Address_DeviceType;
//发送方:设备编号,设备编号采用各设备的入网编号,例如短信网关使用网关ID、对SP使用其企业代码,该设备编号由MISC分配,并且在同一设备类型中该编号唯一
private string send_Address_DeviceID;
//同上接收方
private int dest_Address_DeviceType;
//同上接收方
private string dest_Address_DeviceID;
//FeeUser_ID与DestUser_ID节点
//计费用户标识:用户标识类型 1:用手机号标识 2:用伪码标识 3:两者同时标识
private int feeUser_ID_UserIDType;
//计费用户标识:用户手机号
private string feeUser_ID_MSISDN;
//计费用户标识:用户伪码
private string feeUser_ID_PseudoCode;
//同上使用用户标识
private int destUser_ID_UserIDType;
//同上使用用户标识
private string destUser_ID_MSISDN;
//同上使用用户标识
private string destUser_ID_PseudoCode;
//临时订购关系的事务ID
private string linkID;
/*服务状态管理动作代码,具体值如下:
1: 开通服务;
2: 停止服务;
3: 激活服务;
4: 暂停服务;*/
private int actionID;
/*产生服务状态管理动作原因的代码,具体值如下:
1:用户发起行为
2:Admin&1860发起行为
3:Boss停机
4:Boss开机
5:Boss过户
6:Boss销户
7:Boss改号
8:扣费失败导致的服务取消
9:其他*/
private int actionReasonID;
//该字段及对应属性用于反向接口中Service_ID节点
private int serviceIDType;
//SP的企业代码
private string spid;
//SP中该服务的服务代码
private string spServiceID;
//服务的访问方式 1:WEB 2:WAP 3:SMS
private int accessMode;
//服务订购参数(base64加密),内容是长号码+空格+用户发送内容
private string featureStr;
public string MsgType
{
get { return this.msgType; }
set { this.msgType = value; }
}
public string TransactionID
{
get { return this.transactionID; }
set { this.transactionID = value; }
}
public string Version
{
get { return this.version; }
set { this.version = value; }
}
public int Send_Address_DeviceType
{
get { return this.send_Address_DeviceType; }
set { this.send_Address_DeviceType = value; }
}
public string Send_Address_DeviceID
{
get { return this.send_Address_DeviceID; }
set { this.send_Address_DeviceID = value; }
}
public int Dest_Address_DeviceType
{
get { return this.dest_Address_DeviceType; }
set { this.dest_Address_DeviceType = value; }
}
public string Dest_Address_DeviceID
{
get { return this.dest_Address_DeviceID; }
set { this.dest_Address_DeviceID = value; }
}
public int FeeUser_ID_UserIDType
{
get { return this.feeUser_ID_UserIDType; }
set { this.feeUser_ID_UserIDType = value; }
}
public string FeeUser_ID_MSISDN
{
get { return this.feeUser_ID_MSISDN; }
set { this.feeUser_ID_MSISDN = value; }
}
public string FeeUser_ID_PseudoCode
{
get { return this.feeUser_ID_PseudoCode; }
set { this.feeUser_ID_PseudoCode = value; }
}
public int DestUser_ID_UserIDType
{
get { return this.destUser_ID_UserIDType; }
set { this.destUser_ID_UserIDType = value; }
}
public string DestUser_ID_MSISDN
{
get { return this.destUser_ID_MSISDN; }
set { this.destUser_ID_MSISDN = value; }
}
public string DestUser_ID_PseudoCode
{
get { return this.destUser_ID_PseudoCode; }
set { this.destUser_ID_PseudoCode = value; }
}
public string LinkID
{
get { return this.linkID; }
set { this.linkID = value; }
}
public int ActionID
{
get { return this.actionID; }
set { this.actionID = value; }
}
public int ActionReasonID
{
get { return this.actionReasonID; }
set { this.actionReasonID = value; }
}
public int ServiceIDType
{
get { return this.serviceIDType; }
set { this.serviceIDType = value; }
}
public string SPID
{
get { return this.spid; }
set { this.spid = value; }
}
public string SPServiceID
{
get { return this.spServiceID; }
set { this.spServiceID = value; }
}
public int AccessMode
{
get { return this.accessMode; }
set { this.accessMode = value; }
}
public string FeatureStr
{
get { return this.featureStr; }
set { this.featureStr = value; }
}
}
}
/// <summary>
/// 移动梦网 MISC 1.6 接口
/// 业务实体模型
/// create by hello world at 2006-11-29 (QQ:8935300)
/// </summary>
namespace Com.Rondi.MISC16
{
public class ProvisionInfo
{
public ProvisionInfo() { }
//消息类型
private string msgType;
//该消息编号
private string transactionID;
//该接口消息的版本号,本次所有的接口消息的版本都为“1.5.0”
private string version;
//Send_Address节点与Dest_Address节点
/*发送方:设备类型
0:MISC
100:ISMG
101:WAP SP PROXY
1XX:其他业务网关
200:WAP PORTAL
201:WWW PORTAL
202:VOICE PORTAL
203:PDA PORTAL
2XX:其他门户
300:MMSC
301:KJAVA SERVER
302:LSP
3XX:其它应用平台 */
private int send_Address_DeviceType;
//发送方:设备编号,设备编号采用各设备的入网编号,例如短信网关使用网关ID、对SP使用其企业代码,该设备编号由MISC分配,并且在同一设备类型中该编号唯一
private string send_Address_DeviceID;
//同上接收方
private int dest_Address_DeviceType;
//同上接收方
private string dest_Address_DeviceID;
//FeeUser_ID与DestUser_ID节点
//计费用户标识:用户标识类型 1:用手机号标识 2:用伪码标识 3:两者同时标识
private int feeUser_ID_UserIDType;
//计费用户标识:用户手机号
private string feeUser_ID_MSISDN;
//计费用户标识:用户伪码
private string feeUser_ID_PseudoCode;
//同上使用用户标识
private int destUser_ID_UserIDType;
//同上使用用户标识
private string destUser_ID_MSISDN;
//同上使用用户标识
private string destUser_ID_PseudoCode;
//临时订购关系的事务ID
private string linkID;
/*服务状态管理动作代码,具体值如下:
1: 开通服务;
2: 停止服务;
3: 激活服务;
4: 暂停服务;*/
private int actionID;
/*产生服务状态管理动作原因的代码,具体值如下:
1:用户发起行为
2:Admin&1860发起行为
3:Boss停机
4:Boss开机
5:Boss过户
6:Boss销户
7:Boss改号
8:扣费失败导致的服务取消
9:其他*/
private int actionReasonID;
//该字段及对应属性用于反向接口中Service_ID节点
private int serviceIDType;
//SP的企业代码
private string spid;
//SP中该服务的服务代码
private string spServiceID;
//服务的访问方式 1:WEB 2:WAP 3:SMS
private int accessMode;
//服务订购参数(base64加密),内容是长号码+空格+用户发送内容
private string featureStr;
public string MsgType
{
get { return this.msgType; }
set { this.msgType = value; }
}
public string TransactionID
{
get { return this.transactionID; }
set { this.transactionID = value; }
}
public string Version
{
get { return this.version; }
set { this.version = value; }
}
public int Send_Address_DeviceType
{
get { return this.send_Address_DeviceType; }
set { this.send_Address_DeviceType = value; }
}
public string Send_Address_DeviceID
{
get { return this.send_Address_DeviceID; }
set { this.send_Address_DeviceID = value; }
}
public int Dest_Address_DeviceType
{
get { return this.dest_Address_DeviceType; }
set { this.dest_Address_DeviceType = value; }
}
public string Dest_Address_DeviceID
{
get { return this.dest_Address_DeviceID; }
set { this.dest_Address_DeviceID = value; }
}
public int FeeUser_ID_UserIDType
{
get { return this.feeUser_ID_UserIDType; }
set { this.feeUser_ID_UserIDType = value; }
}
public string FeeUser_ID_MSISDN
{
get { return this.feeUser_ID_MSISDN; }
set { this.feeUser_ID_MSISDN = value; }
}
public string FeeUser_ID_PseudoCode
{
get { return this.feeUser_ID_PseudoCode; }
set { this.feeUser_ID_PseudoCode = value; }
}
public int DestUser_ID_UserIDType
{
get { return this.destUser_ID_UserIDType; }
set { this.destUser_ID_UserIDType = value; }
}
public string DestUser_ID_MSISDN
{
get { return this.destUser_ID_MSISDN; }
set { this.destUser_ID_MSISDN = value; }
}
public string DestUser_ID_PseudoCode
{
get { return this.destUser_ID_PseudoCode; }
set { this.destUser_ID_PseudoCode = value; }
}
public string LinkID
{
get { return this.linkID; }
set { this.linkID = value; }
}
public int ActionID
{
get { return this.actionID; }
set { this.actionID = value; }
}
public int ActionReasonID
{
get { return this.actionReasonID; }
set { this.actionReasonID = value; }
}
public int ServiceIDType
{
get { return this.serviceIDType; }
set { this.serviceIDType = value; }
}
public string SPID
{
get { return this.spid; }
set { this.spid = value; }
}
public string SPServiceID
{
get { return this.spServiceID; }
set { this.spServiceID = value; }
}
public int AccessMode
{
get { return this.accessMode; }
set { this.accessMode = value; }
}
public string FeatureStr
{
get { return this.featureStr; }
set { this.featureStr = value; }
}
}
}
二、正向同步、取消接口
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;
using System.Text;
/// <summary>
/// 移动梦网 MISC 1.6 接口
/// 正向同步接口
/// create by hello world at 2006-11-29
/// </summary>
public partial class MISC16_SyncOrderRelationReq : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//基本参数
Request.ContentType = "text/xml";
Request.ContentEncoding = System.Text.Encoding.UTF8;
XmlDocument doc = new XmlDocument();
ProvisionInfo myP = new ProvisionInfo();
//返回结果参数
string MsgType = "SyncOrderRelationResp";
string TransactionID = "";
string Version = "1.5.0";
int hRet = 1;
using (Stream sm = Request.InputStream)
{
if (sm != null && sm.Length > 0)
{
doc.Load(Request.InputStream);
}
sm.Close();
}
//如果有数据
if (doc.InnerXml.Length > 0)
{
try
{
#region 获取数据
XmlElement root = doc.DocumentElement;
foreach (XmlNode node in root.ChildNodes[0])//遍历SOAP-ENV:Header节点
{
if (node.Name == "TransactionID")
{
myP.TransactionID = node.InnerText;
}
}
foreach (XmlNode node in root.ChildNodes[1].ChildNodes[0])//遍历SOAP-ENV:Body节点的子节点SyncOrderRelationReq
{
if (node.Name == "Version")
{
myP.Version = node.InnerText;
}
else if (node.Name == "MsgType")
{
myP.MsgType = node.InnerText;
}
else if (node.Name == "LinkID")
{
myP.LinkID = node.InnerText;
}
else if (node.Name == "ActionID" && node.InnerText.Trim().Length > 0)
{
myP.ActionID = int.Parse(node.InnerText);
}
else if (node.Name == "ActionReasonID" && node.InnerText.Trim().Length > 0)
{
myP.ActionReasonID = int.Parse(node.InnerText);
}
else if (node.Name == "SPID")
{
myP.SPID = node.InnerText;
}
else if (node.Name == "SPServiceID")
{
myP.SPServiceID = node.InnerText;
}
else if (node.Name == "AccessMode" && node.InnerText.Trim().Length > 0)
{
myP.AccessMode = int.Parse(node.InnerText);
}
else if (node.Name == "FeatureStr")
{
myP.FeatureStr = node.InnerText;
}
else if (node.Name == "Send_Address" && node.ChildNodes.Count > 0)//子遍历Send_Address节点
{
foreach (XmlNode node1 in node)
{
if (node1.Name == "DeviceType" && node1.InnerText.Trim().Length > 0)
{
myP.Send_Address_DeviceType = int.Parse(node1.InnerText);
}
else if (node1.Name == "DeviceID")
{
myP.Send_Address_DeviceID = node1.InnerText;
}
}
}
else if (node.Name == "Dest_Address" && node.ChildNodes.Count > 0)//子遍历Dest_Address节点
{
foreach (XmlNode node1 in node)
{
if (node1.Name == "DeviceType" && node1.InnerText.Trim().Length > 0)
{
myP.Dest_Address_DeviceType = int.Parse(node1.InnerText);
}
else if (node1.Name == "DeviceID")
{
myP.Dest_Address_DeviceID = node1.InnerText;
}
}
}
else if (node.Name == "FeeUser_ID" && node.ChildNodes.Count > 0)//子遍历FeeUser_ID节点
{
foreach (XmlNode node1 in node)
{
if (node1.Name == "UserIDType" && node1.InnerText.Trim().Length > 0)
{
myP.FeeUser_ID_UserIDType = int.Parse(node1.InnerText);
}
else if (node1.Name == "MSISDN")
{
myP.FeeUser_ID_MSISDN = node1.InnerText;
}
else if (node1.Name == "PseudoCode")
{
myP.FeeUser_ID_PseudoCode = node1.InnerText;
}
}
}
else if (node.Name == "DestUser_ID" && node.ChildNodes.Count > 0)//子遍历DestUser_ID节点
{
foreach (XmlNode node1 in node)
{
if (node1.Name == "UserIDType" && node1.InnerText.Trim().Length > 0)
{
myP.DestUser_ID_UserIDType = int.Parse(node1.InnerText);
}
else if (node1.Name == "MSISDN")
{
myP.DestUser_ID_MSISDN = node1.InnerText;
}
else if (node1.Name == "PseudoCode")
{
myP.DestUser_ID_PseudoCode = node1.InnerText;
}
}
}
}
#endregion
//1、Version 与 MsgType 判断
if (myP.Version == "1.5.0" && myP.MsgType == "SyncOrderRelationReq")
{
//2、SPID 判断
if (myP.SPID == System.Configuration.ConfigurationManager.AppSettings["SPID"].ToString().Trim())
{
//3、SPServiceID 判断
if (myP.SPServiceID.ToUpper() == System.Configuration.ConfigurationManager.AppSettings["SPServiceID"].ToString().Trim().ToUpper())
{
#region 同步操作
//正向订购:请求为开通或激活服务都视为开通请求
if (myP.ActionID == 1 || myP.ActionID == 3)
{
if (...)//调用自己方法与数据库同步
hRet = 0;
else
hRet = 1;
}
//正向取消:请求为停止或暂停都视为取消
if (myP.ActionID == 2 || myP.ActionID == 4)
{
//取消前检测是否存在订购关系(user表的grd_id是否大于0)
if (...)
{
if (...)//调用自己方法与数据库同步
hRet = 0;//取消成功
else
hRet = 1;//调用取消存储过程发生异常,标识为未知错误
}
else
{
hRet = 4011;//SP端不存在订购关系
}
}
#endregion
}
else
{
hRet = 4004;//无效的SPServiceID
}
}
else
{
hRet = 4003;//无效的SPID
}
}
else
{
hRet = 4000;//无效的MsgType
}
}
catch
{
hRet = 1;
}
}
#region 记录日志
using (StreamWriter sw = new StreamWriter(HttpRuntime.AppDomainAppPath + @"MISC16Log" + DateTime.Now.ToString("yyyy_MM_dd") + ".txt", true, System.Text.Encoding.UTF8))
{
sw.WriteLine("request time:" + DateTime.Now.ToString());
sw.WriteLine("request ip:" + Request.UserHostAddress.ToString());
sw.WriteLine("request content:" + doc.InnerXml);
sw.WriteLine("result:" + hRet.ToString());
sw.WriteLine("");
sw.Close();
}
#endregion
#region 返回结果
TransactionID = myP.TransactionID;
Response.Clear();
Response.ContentType = "text/xml";
Response.ContentEncoding = System.Text.Encoding.UTF8;
StringBuilder xmlResult = new StringBuilder("<?xml version="1.0" encoding="utf-8" ?>");
xmlResult.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/">");
xmlResult.Append("<SOAP-ENV:Header>");
xmlResult.Append("<TransactionID xmlns="http://www.monternet.com/dsmp/schemas/">" + TransactionID + "</TransactionID>");
xmlResult.Append("</SOAP-ENV:Header>");
xmlResult.Append("<SOAP-ENV:Body>");
xmlResult.Append("<SyncOrderRelationResp xmlns="http://www.monternet.com/dsmp/schemas/">");
xmlResult.Append("<Version>" + Version + "</Version>");
xmlResult.Append("<MsgType>" + MsgType + "</MsgType>");
xmlResult.Append("<hRet>" + hRet.ToString() + "</hRet>");
xmlResult.Append("</SyncOrderRelationResp>");
xmlResult.Append("</SOAP-ENV:Body>");
xmlResult.Append("</SOAP-ENV:Envelope>");
Response.Write(xmlResult.ToString());
Response.End();
#endregion
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;
using System.Text;
/// <summary>
/// 移动梦网 MISC 1.6 接口
/// 正向同步接口
/// create by hello world at 2006-11-29
/// </summary>
public partial class MISC16_SyncOrderRelationReq : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//基本参数
Request.ContentType = "text/xml";
Request.ContentEncoding = System.Text.Encoding.UTF8;
XmlDocument doc = new XmlDocument();
ProvisionInfo myP = new ProvisionInfo();
//返回结果参数
string MsgType = "SyncOrderRelationResp";
string TransactionID = "";
string Version = "1.5.0";
int hRet = 1;
using (Stream sm = Request.InputStream)
{
if (sm != null && sm.Length > 0)
{
doc.Load(Request.InputStream);
}
sm.Close();
}
//如果有数据
if (doc.InnerXml.Length > 0)
{
try
{
#region 获取数据
XmlElement root = doc.DocumentElement;
foreach (XmlNode node in root.ChildNodes[0])//遍历SOAP-ENV:Header节点
{
if (node.Name == "TransactionID")
{
myP.TransactionID = node.InnerText;
}
}
foreach (XmlNode node in root.ChildNodes[1].ChildNodes[0])//遍历SOAP-ENV:Body节点的子节点SyncOrderRelationReq
{
if (node.Name == "Version")
{
myP.Version = node.InnerText;
}
else if (node.Name == "MsgType")
{
myP.MsgType = node.InnerText;
}
else if (node.Name == "LinkID")
{
myP.LinkID = node.InnerText;
}
else if (node.Name == "ActionID" && node.InnerText.Trim().Length > 0)
{
myP.ActionID = int.Parse(node.InnerText);
}
else if (node.Name == "ActionReasonID" && node.InnerText.Trim().Length > 0)
{
myP.ActionReasonID = int.Parse(node.InnerText);
}
else if (node.Name == "SPID")
{
myP.SPID = node.InnerText;
}
else if (node.Name == "SPServiceID")
{
myP.SPServiceID = node.InnerText;
}
else if (node.Name == "AccessMode" && node.InnerText.Trim().Length > 0)
{
myP.AccessMode = int.Parse(node.InnerText);
}
else if (node.Name == "FeatureStr")
{
myP.FeatureStr = node.InnerText;
}
else if (node.Name == "Send_Address" && node.ChildNodes.Count > 0)//子遍历Send_Address节点
{
foreach (XmlNode node1 in node)
{
if (node1.Name == "DeviceType" && node1.InnerText.Trim().Length > 0)
{
myP.Send_Address_DeviceType = int.Parse(node1.InnerText);
}
else if (node1.Name == "DeviceID")
{
myP.Send_Address_DeviceID = node1.InnerText;
}
}
}
else if (node.Name == "Dest_Address" && node.ChildNodes.Count > 0)//子遍历Dest_Address节点
{
foreach (XmlNode node1 in node)
{
if (node1.Name == "DeviceType" && node1.InnerText.Trim().Length > 0)
{
myP.Dest_Address_DeviceType = int.Parse(node1.InnerText);
}
else if (node1.Name == "DeviceID")
{
myP.Dest_Address_DeviceID = node1.InnerText;
}
}
}
else if (node.Name == "FeeUser_ID" && node.ChildNodes.Count > 0)//子遍历FeeUser_ID节点
{
foreach (XmlNode node1 in node)
{
if (node1.Name == "UserIDType" && node1.InnerText.Trim().Length > 0)
{
myP.FeeUser_ID_UserIDType = int.Parse(node1.InnerText);
}
else if (node1.Name == "MSISDN")
{
myP.FeeUser_ID_MSISDN = node1.InnerText;
}
else if (node1.Name == "PseudoCode")
{
myP.FeeUser_ID_PseudoCode = node1.InnerText;
}
}
}
else if (node.Name == "DestUser_ID" && node.ChildNodes.Count > 0)//子遍历DestUser_ID节点
{
foreach (XmlNode node1 in node)
{
if (node1.Name == "UserIDType" && node1.InnerText.Trim().Length > 0)
{
myP.DestUser_ID_UserIDType = int.Parse(node1.InnerText);
}
else if (node1.Name == "MSISDN")
{
myP.DestUser_ID_MSISDN = node1.InnerText;
}
else if (node1.Name == "PseudoCode")
{
myP.DestUser_ID_PseudoCode = node1.InnerText;
}
}
}
}
#endregion
//1、Version 与 MsgType 判断
if (myP.Version == "1.5.0" && myP.MsgType == "SyncOrderRelationReq")
{
//2、SPID 判断
if (myP.SPID == System.Configuration.ConfigurationManager.AppSettings["SPID"].ToString().Trim())
{
//3、SPServiceID 判断
if (myP.SPServiceID.ToUpper() == System.Configuration.ConfigurationManager.AppSettings["SPServiceID"].ToString().Trim().ToUpper())
{
#region 同步操作
//正向订购:请求为开通或激活服务都视为开通请求
if (myP.ActionID == 1 || myP.ActionID == 3)
{
if (...)//调用自己方法与数据库同步
hRet = 0;
else
hRet = 1;
}
//正向取消:请求为停止或暂停都视为取消
if (myP.ActionID == 2 || myP.ActionID == 4)
{
//取消前检测是否存在订购关系(user表的grd_id是否大于0)
if (...)
{
if (...)//调用自己方法与数据库同步
hRet = 0;//取消成功
else
hRet = 1;//调用取消存储过程发生异常,标识为未知错误
}
else
{
hRet = 4011;//SP端不存在订购关系
}
}
#endregion
}
else
{
hRet = 4004;//无效的SPServiceID
}
}
else
{
hRet = 4003;//无效的SPID
}
}
else
{
hRet = 4000;//无效的MsgType
}
}
catch
{
hRet = 1;
}
}
#region 记录日志
using (StreamWriter sw = new StreamWriter(HttpRuntime.AppDomainAppPath + @"MISC16Log" + DateTime.Now.ToString("yyyy_MM_dd") + ".txt", true, System.Text.Encoding.UTF8))
{
sw.WriteLine("request time:" + DateTime.Now.ToString());
sw.WriteLine("request ip:" + Request.UserHostAddress.ToString());
sw.WriteLine("request content:" + doc.InnerXml);
sw.WriteLine("result:" + hRet.ToString());
sw.WriteLine("");
sw.Close();
}
#endregion
#region 返回结果
TransactionID = myP.TransactionID;
Response.Clear();
Response.ContentType = "text/xml";
Response.ContentEncoding = System.Text.Encoding.UTF8;
StringBuilder xmlResult = new StringBuilder("<?xml version="1.0" encoding="utf-8" ?>");
xmlResult.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/">");
xmlResult.Append("<SOAP-ENV:Header>");
xmlResult.Append("<TransactionID xmlns="http://www.monternet.com/dsmp/schemas/">" + TransactionID + "</TransactionID>");
xmlResult.Append("</SOAP-ENV:Header>");
xmlResult.Append("<SOAP-ENV:Body>");
xmlResult.Append("<SyncOrderRelationResp xmlns="http://www.monternet.com/dsmp/schemas/">");
xmlResult.Append("<Version>" + Version + "</Version>");
xmlResult.Append("<MsgType>" + MsgType + "</MsgType>");
xmlResult.Append("<hRet>" + hRet.ToString() + "</hRet>");
xmlResult.Append("</SyncOrderRelationResp>");
xmlResult.Append("</SOAP-ENV:Body>");
xmlResult.Append("</SOAP-ENV:Envelope>");
Response.Write(xmlResult.ToString());
Response.End();
#endregion
}
}
三、反向订购
/// <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(this.subscribeServiceReq);
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>
/// <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(this.subscribeServiceReq);
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(this.subscribeServiceReq);
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>
/// <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(this.subscribeServiceReq);
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;
}
-----------------------------------------------------------------