ASP.net通过http调用验证码短信接口源码

通过验证码短信http调用接口,您可以很快速的在网站或者app中集成手机号验证功能,该源码只是核心代码,具体可以根据您的实际需求进行扩展。

该DEMO是ASP.net通过http调用验证码短信接口源码;

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

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "smsSoap", Namespace = "http://106.ihuyi.com/")]
public partial class sms : System.Web.Services.Protocols.SoapHttpClientProtocol
{

    private System.Threading.SendOrPostCallback SubmitOperationCompleted;

    /// <remarks/>
    public sms()
    {
        this.Url = "http://106.ihuyi.com/webservice/sms.php?smsService";
    }

    /// <remarks/>
    public event SubmitCompletedEventHandler SubmitCompleted;

    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.xmlsoap.org/Submit", RequestNamespace = "http://106.ihuyi.com/", ResponseNamespace = "http://106.ihuyi.com/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public SubmitResult Submit(string account, string password, string mobile, string content)
    {
        object[] results = this.Invoke("Submit", new object[] {
                    account,
                    password,
                    mobile,
                    content});
        return ((SubmitResult)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BeginSubmit(string account, string password, string mobile, string content, System.AsyncCallback callback, object asyncState)
    {
        return this.BeginInvoke("Submit", new object[] {
                    account,
                    password,
                    mobile,
                    content}, callback, asyncState);
    }

    /// <remarks/>
    public SubmitResult EndSubmit(System.IAsyncResult asyncResult)
    {
        object[] results = this.EndInvoke(asyncResult);
        return ((SubmitResult)(results[0]));
    }

    /// <remarks/>
    public void SubmitAsync(string account, string password, string mobile, string content)
    {
        this.SubmitAsync(account, password, mobile, content, null);
    }

    /// <remarks/>
    public void SubmitAsync(string account, string password, string mobile, string content, object userState)
    {
        if ((this.SubmitOperationCompleted == null))
        {
            this.SubmitOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubmitOperationCompleted);
        }
        this.InvokeAsync("Submit", new object[] {
                    account,
                    password,
                    mobile,
                    content}, this.SubmitOperationCompleted, userState);
    }

    private void OnSubmitOperationCompleted(object arg)
    {
        if ((this.SubmitCompleted != null))
        {
            System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
            this.SubmitCompleted(this, new SubmitCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
        }
    }

    /// <remarks/>
    public new void CancelAsync(object userState)
    {
        base.CancelAsync(userState);
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://106.ihuyi.com/")]
public partial class SubmitResult
{

    private int codeField;

    private string msgField;

    private int smsidField;

    /// <remarks/>
    public int code
    {
        get
        {
            return this.codeField;
        }
        set
        {
            this.codeField = value;
        }
    }

    /// <remarks/>
    public string msg
    {
        get
        {
            return this.msgField;
        }
        set
        {
            this.msgField = value;
        }
    }

    /// <remarks/>
    public int smsid
    {
        get
        {
            return this.smsidField;
        }
        set
        {
            this.smsidField = value;
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
public delegate void SubmitCompletedEventHandler(object sender, SubmitCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SubmitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{

    private object[] results;

    internal SubmitCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
        base(exception, cancelled, userState)
    {
        this.results = results;
    }

    /// <remarks/>
    public SubmitResult Result
    {
        get
        {
            this.RaiseExceptionIfNecessary();
            return ((SubmitResult)(this.results[0]));
        }
    }
}

自助申请帐户地址: http://www.ihuyi.com/product.php
完整接口文件地址: http://www.ihuyi.com/upload/file/cu-fa-jie-kou.rar  

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值