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

第一步:定义一个接口

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("", Use = System.Web.Services.Description.SoapBindingUse.Literal, 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("", Use = System.Web.Services.Description.SoapBindingUse.Literal, 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("", Use = System.Web.Services.Description.SoapBindingUse.Literal, 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网关的上行消息和上行指令就能接收啦,至于短信下行比较简单,在此不做解释!如有问题希望各位大侠批评指正,谢谢!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一. ISAG接入篇 4 1. ISAG简介 4 1.1 ISAG在电信网络里面的位置 6 1.2 ISAG与WEB SERVICE技术 6 1.3开发环境搭建 7 1.3.1 安装JDK 7 1.3.2下载安装ECLIPSE 7 1.3.3 安装WTP模块 8 1.3.4 安装Tomcat 9 1.3.5 ISAG接口相关通用参数及说明 10 2. SMS 13 2.1短信接口开发环境搭建 13 2.2 SendSMS短信发送接口开发 19 2.3 SendSMS短信上行,回执接口开发 39 3. WAP PUSH 46 3.1 WAP PUSH简介 46 3.2 WAP PUSH网络结构和业务实现 46 3.3 WAP PUSH是什么?WAP PUSH不是什么? 48 3.4 WAP Push接口开发环境搭建 49 3.5 WAP Push发送接口开发 53 3.6 WAP Push 状态报告接口开发 58 4. 彩信 61 4.1彩信的构成 61 4.2 彩信在电信网络里面的网络结构 62 4.3 彩信开发接口开发环境搭建 63 彩信发送接口开发 69 4.5 彩信上行 81 5.1 TcpMon使用 94 5.2 Web Services Explorer 98 附录一: SendSms短信发送接口报文数据: 100 1.1请求(SP发起): 100 2.2应答(ISAG应答) 101 附录二: WAP PUSH发送报文数据: 102 1.1请求(SP发起): 102 2.2应答(ISAG应答) 103 附录三: SendMessage彩信发送接口报文数据: 104 1.1请求(SP发起): 104 1.2 ISAG响应 106 二. 与ISMP接口实现 107 1.ISMP简介 107 1.1与ISMP相关的术语 107 2.业务流程 109 2.1点播业务流程 109 2.2包月业务流程 110 3. ISMP接口开发环境搭建 111 4. 订购关系同步orderRelationUpdateNotify方法实现 117 5. 管理信息同步notifyManagementInfo方法实现 122 6. 服务使用通知接口serviceConsumeNotify方法实现 124 7.反向取消接口spWithdrawSubscription接口实现 126 8. 程序部署 129 9. 接口测试 131 三.WAP业务开发 135 1 WAP业务简介 135 1.1 WAP业务的网络结构 136 1.2 WAP业务实现原理 137 2 点播实现 140 3 包月实现 142 4. WAP 1.0还是WAP 2.0 144 5.UA适配 145

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值