加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

ISAG 网关接收上行消息和接收订购指令

发布时间:2020-12-17 01:20:43 所属栏目:安全 来源:网络整理
导读:第一步:定义一个接口 using System; using System.ComponentModel; using System.Diagnostics; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Serialization; // // 此源代码由 wsdl 自动生成,Version=2.0.50727.1432

第一步:定义一个接口

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

//
// 此源代码由 wsdl 自动生成,Version=2.0.50727.1432。
//


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl","2.0.50727.1432")]
[System.Web.Services.WebServiceBindingAttribute(Name = "IsmpSpEngineSoapBinding",Namespace = "http://sp.ismp.chinatelecom.com")]
public interface IIsmpSpEngineSoapBinding
{

??? /// <remarks/>
??? [System.Web.Services.WebMethodAttribute()]
??? [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",Use = System.Web.Services.Description.SoapBindingUse.Literal,ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
??? [return: System.Xml.Serialization.XmlElementAttribute("orderRelationUpdateNotifyReturn",Namespace = "http://sp.ismp.chinatelecom.com")]
??? Response orderRelationUpdateNotify([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] OrderRelationUpdateNotifyReq orderRelationUpdateNotifyReq);

??? /// <remarks/>
??? [System.Web.Services.WebMethodAttribute()]
??? [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
??? [return: System.Xml.Serialization.XmlElementAttribute("serviceConsumeNotifyReturn",Namespace = "http://sp.ismp.chinatelecom.com")]
??? Response serviceConsumeNotify([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] ServiceConsumeNotifyReq serviceConsumeNotifyReqPara);

??? /// <remarks/>
??? [System.Web.Services.WebMethodAttribute()]
??? [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
??? [return: System.Xml.Serialization.XmlElementAttribute("spWithdrawSubscriptionReturn",Namespace = "http://sp.ismp.chinatelecom.com")]
??? Response spWithdrawSubscription([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] SPWithdrawSubscriptionReq spWithdrawSubscriptionReqPara);

??? /// <remarks/>
??? [System.Web.Services.WebMethodAttribute()]
??? [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
??? [return: System.Xml.Serialization.XmlElementAttribute("notifyManagementInfoReturn",Namespace = "http://sp.ismp.chinatelecom.com")]
??? NotifyManagementInfoRsp notifyManagementInfo([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] NotifyManagementInfoReq notifyManagementInfoReq);
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl","2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://req.sp.ismp.chinatelecom.com")]
public partial class OrderRelationUpdateNotifyReq
{

??? private int oPTypeField;

??? private string packageIDField;

??? private string oldPackageIDField;

??? private string productIDField;

??? private string oldProductIDField;

??? private string streamingNoField;

??? private string userIDField;

??? private int userIDTypeField;

??? private string[] verUserIDField;

??? /// <remarks/>
??? public int OPType
??? {
??????? get
??????? {
??????????? return this.oPTypeField;
??????? }
??????? set
??????? {
??????????? this.oPTypeField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string packageID
??? {
??????? get
??????? {
??????????? return this.packageIDField;
??????? }
??????? set
??????? {
??????????? this.packageIDField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string oldPackageID
??? {
??????? get
??????? {
??????????? return this.oldPackageIDField;
??????? }
??????? set
??????? {
??????????? this.oldPackageIDField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string productID
??? {
??????? get
??????? {
??????????? return this.productIDField;
??????? }
??????? set
??????? {
??????????? this.productIDField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string oldProductID
??? {
??????? get
??????? {
??????????? return this.oldProductIDField;
??????? }
??????? set
??????? {
??????????? this.oldProductIDField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string streamingNo
??? {
??????? get
??????? {
??????????? return this.streamingNoField;
??????? }
??????? set
??????? {
??????????? this.streamingNoField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string userID
??? {
??????? get
??????? {
??????????? return this.userIDField;
??????? }
??????? set
??????? {
??????????? this.userIDField = value;
??????? }
??? }

??? /// <remarks/>
??? public int userIDType
??? {
??????? get
??????? {
??????????? return this.userIDTypeField;
??????? }
??????? set
??????? {
??????????? this.userIDTypeField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute("VerUserID",IsNullable = true)]
??? public string[] VerUserID
??? {
??????? get
??????? {
??????????? return this.verUserIDField;
??????? }
??????? set
??????? {
??????????? this.verUserIDField = value;
??????? }
??? }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl","2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://rsp.sp.ismp.chinatelecom.com")]
public partial class NotifyManagementInfoRsp
{

??? private int resultCodeField;

??? private string streamingNoField;

??? /// <remarks/>
??? public int resultCode
??? {
??????? get
??????? {
??????????? return this.resultCodeField;
??????? }
??????? set
??????? {
??????????? this.resultCodeField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string streamingNo
??? {
??????? get
??????? {
??????????? return this.streamingNoField;
??????? }
??????? set
??????? {
??????????? this.streamingNoField = value;
??????? }
??? }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl","2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://req.sp.ismp.chinatelecom.com")]
public partial class NotifyManagementInfoReq
{

??? private string idField;

??? private int iDTypeField;

??? private int statusField;

??? private string streamingNoField;

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string ID
??? {
??????? get
??????? {
??????????? return this.idField;
??????? }
??????? set
??????? {
??????????? this.idField = value;
??????? }
??? }

??? /// <remarks/>
??? public int IDType
??? {
??????? get
??????? {
??????????? return this.iDTypeField;
??????? }
??????? set
??????? {
??????????? this.iDTypeField = value;
??????? }
??? }

??? /// <remarks/>
??? public int status
??? {
??????? get
??????? {
??????????? return this.statusField;
??????? }
??????? set
??????? {
??????????? this.statusField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string streamingNo
??? {
??????? get
??????? {
??????????? return this.streamingNoField;
??????? }
??????? set
??????? {
??????????? this.streamingNoField = value;
??????? }
??? }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl","2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://req.sp.ismp.chinatelecom.com")]
public partial class SPWithdrawSubscriptionReq
{

??? private int userIDTypeField;

??? private string userIDField;

??? private int iDTypeField;

??? private string idField;

??? private string streamingNoField;

??? private string sPIDField;

??? private string sPAdminField;

??? private string sPAdminPwdField;

??? /// <remarks/>
??? public int userIDType
??? {
??????? get
??????? {
??????????? return this.userIDTypeField;
??????? }
??????? set
??????? {
??????????? this.userIDTypeField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string userID
??? {
??????? get
??????? {
??????????? return this.userIDField;
??????? }
??????? set
??????? {
??????????? this.userIDField = value;
??????? }
??? }

??? /// <remarks/>
??? public int IDType
??? {
??????? get
??????? {
??????????? return this.iDTypeField;
??????? }
??????? set
??????? {
??????????? this.iDTypeField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string ID
??? {
??????? get
??????? {
??????????? return this.idField;
??????? }
??????? set
??????? {
??????????? this.idField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string streamingNo
??? {
??????? get
??????? {
??????????? return this.streamingNoField;
??????? }
??????? set
??????? {
??????????? this.streamingNoField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string SPID
??? {
??????? get
??????? {
??????????? return this.sPIDField;
??????? }
??????? set
??????? {
??????????? this.sPIDField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string SPAdmin
??? {
??????? get
??????? {
??????????? return this.sPAdminField;
??????? }
??????? set
??????? {
??????????? this.sPAdminField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string SPAdminPwd
??? {
??????? get
??????? {
??????????? return this.sPAdminPwdField;
??????? }
??????? set
??????? {
??????????? this.sPAdminPwdField = value;
??????? }
??? }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl","2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://req.sp.ismp.chinatelecom.com")]
public partial class ServiceConsumeNotifyReq
{

??? private string featureStrField;

??? private string linkIDField;

??? private string productIDField;

??? private string streamingNoField;

??? private string userIDField;

??? private int userIDTypeField;

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string featureStr
??? {
??????? get
??????? {
??????????? return this.featureStrField;
??????? }
??????? set
??????? {
??????????? this.featureStrField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string linkID
??? {
??????? get
??????? {
??????????? return this.linkIDField;
??????? }
??????? set
??????? {
??????????? this.linkIDField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string productID
??? {
??????? get
??????? {
??????????? return this.productIDField;
??????? }
??????? set
??????? {
??????????? this.productIDField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string streamingNo
??? {
??????? get
??????? {
??????????? return this.streamingNoField;
??????? }
??????? set
??????? {
??????????? this.streamingNoField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string userID
??? {
??????? get
??????? {
??????????? return this.userIDField;
??????? }
??????? set
??????? {
??????????? this.userIDField = value;
??????? }
??? }

??? /// <remarks/>
??? public int userIDType
??? {
??????? get
??????? {
??????????? return this.userIDTypeField;
??????? }
??????? set
??????? {
??????????? this.userIDTypeField = value;
??????? }
??? }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl","2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://rsp.sp.ismp.chinatelecom.com")]
public partial class Response
{

??? private int resultCodeField;

??? private string streamingNoField;

??? /// <remarks/>
??? public int resultCode
??? {
??????? get
??????? {
??????????? return this.resultCodeField;
??????? }
??????? set
??????? {
??????????? this.resultCodeField = value;
??????? }
??? }

??? /// <remarks/>
??? [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
??? public string streamingNo
??? {
??????? get
??????? {
??????????? return this.streamingNoField;
??????? }
??????? set
??????? {
??????????? this.streamingNoField = value;
??????? }
??? }
}

?

第二步:接收上行指令

?

??? /// <summary>
??? ///IsmpSpService 的摘要说明
??? /// </summary>
??? [WebService(Namespace = "http://rsp.sp.ismp.chinatelecom.com")]
??? [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
??? //若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
??? // [System.Web.Script.Services.ScriptService]
??? [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
??? public class IsmpSpService : System.Web.Services.WebService,IIsmpSpEngineSoapBinding
??? {

??????? [WebMethod]
??????? public string HelloWorld()
??????? {
??????????? return "Hello World";
??????? }

??????? #region IIsmpSpEngineSoapBinding 成员

??????? public Response orderRelationUpdateNotify(OrderRelationUpdateNotifyReq orderRelationUpdateNotifyReq)
??????? {
??????????? string oldPackageID = orderRelationUpdateNotifyReq.oldPackageID;
??????????? string oldProductID = orderRelationUpdateNotifyReq.oldProductID;
??????????? int OPType = orderRelationUpdateNotifyReq.OPType;
??????????? string packageID = orderRelationUpdateNotifyReq.packageID;
??????????? string productID = orderRelationUpdateNotifyReq.productID;
??????????? string streamingNo = orderRelationUpdateNotifyReq.streamingNo;
??????????? string userID = orderRelationUpdateNotifyReq.userID;
??????????? int userIDType = orderRelationUpdateNotifyReq.userIDType;
??????????? string[] VerUserID = orderRelationUpdateNotifyReq.VerUserID;
??????????? string verUserid = "";
??????????? if (VerUserID != null)
??????????? {
??????????????? for (int i = 0; i < VerUserID.Length; i++)
??????????????? {
??????????????????? verUserid = verUserid + VerUserID[i].ToString() + ",";
??????????????? }
??????????? }

????????????//此处实现业务逻辑


??????????? Response response = new Response();
?????????? // response.
??????????? response.resultCode = 0;
??????????? response.streamingNo = streamingNo;

??????????? //StreamWriter sw = new StreamWriter("c://orderRelationUpdateNotify.txt",true);
??????????? //sw.WriteLine("orderRelationUpdateNotify");
??????????? //sw.Close();

??????????? return response;
?????????? // throw new NotImplementedException();
??????? }

??????? public Response serviceConsumeNotify(ServiceConsumeNotifyReq serviceConsumeNotifyReqPara)
??????? {
??????????? throw new NotImplementedException();
??????? }

??????? public Response spWithdrawSubscription(SPWithdrawSubscriptionReq spWithdrawSubscriptionReqPara)
??????? {
??????????? throw new NotImplementedException();
??????? }

??????? public NotifyManagementInfoRsp notifyManagementInfo(NotifyManagementInfoReq notifyManagementInfoReq)
??????? {
?????????? throw new NotImplementedException();
??????? }

??????? #endregion
??? }

?

第三步:接收上行消息

?

??? /// <summary>
??? ///Notification 的摘要说明
??? /// </summary>
??? ///
??? //[WebService(Namespace = "http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1")]
??? //[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
??? //[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]

??? [WebService(Namespace = "http://www.chinatelecom.com.cn/wsdl/ctcc/sms/send/v2_1/interface")]
??? [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
??? //若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
??? // [System.Web.Script.Services.ScriptService]
??? [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
??? public class Notification : System.Web.Services.WebService,ISmsNotificationBinding
??? {
??????? public Notification()
??????? {

??????? }


??????? [WebMethod]
??????? public notifySmsDeliveryReceiptResponse notifySmsDeliveryReceipt(notifySmsDeliveryReceipt notifySmsDeliveryReceipt1)
??????? {


??????????? string correlator = notifySmsDeliveryReceipt1.correlator;

?


??????????? DeliveryInformation deliveryInformation = (DeliveryInformation)(notifySmsDeliveryReceipt1.deliveryStatus);
??????????? if (deliveryInformation != null)
??????????? {

??????????????? string address = deliveryInformation.address;
??????????????? DeliveryStatus deliver = deliveryInformation.deliveryStatus;
??????????????? string deliveryStatus = "DeliveredToNetwork";

??????????????? if (deliver == DeliveryStatus.DeliveredToNetwork)
??????????????? {
??????????????????? deliveryStatus = "DeliveredToNetwork";
??????????????? }
??????????????? else if (deliver == DeliveryStatus.AuthPriceFailed)
??????????????? {
??????????????????? deliveryStatus = "AuthPriceFailed";
??????????????? }
??????????????? else if (deliver == DeliveryStatus.DeliveryImpossible)
??????????????? {
??????????????????? deliveryStatus = "DeliveryImpossible";
??????????????? }
??????????????? else if (deliver == DeliveryStatus.DeliveryNotificationNotSupported)
??????????????? {
??????????????????? deliveryStatus = "DeliveryNotificationNotSupported";
??????????????? }
??????????????? else if (deliver == DeliveryStatus.DeliveryUncertain)
??????????????? {
??????????????????? deliveryStatus = "DeliveryUncertain";
??????????????? }
??????????????? else if (deliver == DeliveryStatus.MessageWaiting)
??????????????? {
??????????????????? deliveryStatus = "MessageWaiting";
??????????????? }
??????????????? else if (deliver == DeliveryStatus.DeliveredToTerminal)
??????????????? {
??????????????????? deliveryStatus = "DeliveredToTerminal";
??????????????? }
??????????????? else
??????????????? {
??????????????????? deliveryStatus = "DeliveredToNetwork";
??????????????? }


??????????????? //此处实现业务逻辑????????????????
??????????? }
??????????? return new notifySmsDeliveryReceiptResponse();//状态
??????? }

??????? private void XmlElement(string p,object p_2)
??????? {
??????????? throw new Exception("The method or operation is not implemented.");
??????? }

??????? //[return: XmlElement("notifySmsReceptionResponse",Namespace = "http://www.chinatelecom.com.cn/schema/ctcc/sms/notification/v2_1/local")]
??????? [WebMethod]
??????? public notifySmsReceptionResponse notifySmsReception(notifySmsReception notifySmsReception1)
??????? {

??????????? return new notifySmsReceptionResponse(); //


??????? }
??? }

?

到此电信ISAG网关的上行消息和上行指令就能接收啦,至于短信下行比较简单,在此不做解释!如有问题希望各位大侠批评指正,谢谢!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读