您的位置:首页 > 理论基础 > 计算机网络

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

2015-03-11 18:09 671 查看
通过验证码短信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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: