1.最近公司上项目,其中有一个小栏目 是查询身份证的,就是输入身份证码和姓名返回你的地址和图片的这种,也就是公安部全国公民身份信息系统(NCIIS)我是第一次,中间有几个问题第一个难题是这样的,要验证证书,当时给文档的时候只有一个地址,也只有安装上了证书文件才能访问,基本的方法是这样的
按上面写的把官方提共的地方输入到地址栏里,然后回车,然后会出现这个对话框,我们只要单击查看证书,就行了,在后面出现的界面 里单击安装就可以了
如果要导出则选择“复制到文件” ==下一步 “Base64编码x.509 (.cer)(s)”选择这一项下一步完成就OK了。
然后把你的证书文件复制到一个位置方便使用。文件名假设为tingting.cer(cer表示证书文件);
下面获取WSDL文件(C#):
Application.StartupPath + "tingting.cer/" 这里就是我们刚才导出的证书文件的地址,当然我们在实际应用中要写成自己的才行;
request.UserAgent = "Client Cert Sample"; User-AgentHTTP标头的值这个可以参考这里 http://support.microsoft.com/kb/895971
下面是详细的代码:
https://www.cnblogs.com/ ?wsdl,单击"确定"看看发生了什么?是的,输出窗口会显示生成了一个类及其存放的位置,看看是不是你选定的文件夹![WSDL手动生成WebService代理类的方法](https://i-blog.csdnimg.cn/blog_migrate/bea52634b98c0610a193349f053769e7.jpeg)
上面是来自http://blog.sina.com.cn/s/blog_48964b120100fz14.html 在这里谢谢了
生成的类文件里会包括 方法使用和怎么样和服务器沟通,我们只要调用 方法就要可以了,
类文件如下
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行库版本:2.0.50727.1873
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
//
// 此源代码由 wsdl 自动生成, Version=2.0.50727.1432。
//
namespace WSDLServices
{
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="nciicGetConditionHttpBinding", Namespace="https://http://www.cnblogs.com/ /nciicGetCondition")]
public partial class nciicGetCondition : System.Web.Services.Protocols.SoapHttpClientProtocol {
private System.Threading.SendOrPostCallback nciicDiscernOperationCompleted;
private System.Threading.SendOrPostCallback nciicCheckChinaOperationCompleted;
private System.Threading.SendOrPostCallback CallnciicGetConditionOperationCompleted;
private System.Threading.SendOrPostCallback nciicExactSearchOperationCompleted;
private System.Threading.SendOrPostCallback nciicCourtOperationCompleted;
private System.Threading.SendOrPostCallback nciicBirthplaceCompareOperationCompleted;
private System.Threading.SendOrPostCallback nciicAddrExactSearchOperationCompleted;
private System.Threading.SendOrPostCallback nciicCheckOperationCompleted;
private System.Threading.SendOrPostCallback nciicCompareOperationCompleted;
private System.Threading.SendOrPostCallback nciicCombineSearchOperationCompleted;
/// <remarks/>
public nciicGetCondition() {
this.Url = "http://http://www.cnblogs.com/ /nciic_ws/services/nciicGetCondition";
}
/// <remarks/>
public event nciicDiscernCompletedEventHandler nciicDiscernCompleted;
/// <remarks/>
public event nciicCheckChinaCompletedEventHandler nciicCheckChinaCompleted;
/// <remarks/>
public event CallnciicGetConditionCompletedEventHandler CallnciicGetConditionCompleted;
/// <remarks/>
public event nciicExactSearchCompletedEventHandler nciicExactSearchCompleted;
/// <remarks/>
public event nciicCourtCompletedEventHandler nciicCourtCompleted;
/// <remarks/>
public event nciicBirthplaceCompareCompletedEventHandler nciicBirthplaceCompareCompleted;
/// <remarks/>
public event nciicAddrExactSearchCompletedEventHandler nciicAddrExactSearchCompleted;
/// <remarks/>
public event nciicCheckCompletedEventHandler nciicCheckCompleted;
/// <remarks/>
public event nciicCompareCompletedEventHandler nciicCompareCompleted;
/// <remarks/>
public event nciicCombineSearchCompletedEventHandler nciicCombineSearchCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string nciicDiscern([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inConditions) {
object[] results = this.Invoke("nciicDiscern", new object[] {
inLicense,
inConditions});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginnciicDiscern(string inLicense, string inConditions, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("nciicDiscern", new object[] {
inLicense,
inConditions}, callback, asyncState);
}
/// <remarks/>
public string EndnciicDiscern(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void nciicDiscernAsync(string inLicense, string inConditions) {
this.nciicDiscernAsync(inLicense, inConditions, null);
}
/// <remarks/>
public void nciicDiscernAsync(string inLicense, string inConditions, object userState) {
if ((this.nciicDiscernOperationCompleted == null)) {
this.nciicDiscernOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnciicDiscernOperationCompleted);
}
this.InvokeAsync("nciicDiscern", new object[] {
inLicense,
inConditions}, this.nciicDiscernOperationCompleted, userState);
}
private void OnnciicDiscernOperationCompleted(object arg) {
if ((this.nciicDiscernCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.nciicDiscernCompleted(this, new nciicDiscernCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string nciicCheckChina([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inConditions) {
object[] results = this.Invoke("nciicCheckChina", new object[] {
inLicense,
inConditions});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginnciicCheckChina(string inLicense, string inConditions, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("nciicCheckChina", new object[] {
inLicense,
inConditions}, callback, asyncState);
}
/// <remarks/>
public string EndnciicCheckChina(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void nciicCheckChinaAsync(string inLicense, string inConditions) {
this.nciicCheckChinaAsync(inLicense, inConditions, null);
}
/// <remarks/>
public void nciicCheckChinaAsync(string inLicense, string inConditions, object userState) {
if ((this.nciicCheckChinaOperationCompleted == null)) {
this.nciicCheckChinaOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnciicCheckChinaOperationCompleted);
}
this.InvokeAsync("nciicCheckChina", new object[] {
inLicense,
inConditions}, this.nciicCheckChinaOperationCompleted, userState);
}
private void OnnciicCheckChinaOperationCompleted(object arg) {
if ((this.nciicCheckChinaCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.nciicCheckChinaCompleted(this, new nciicCheckChinaCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestElementName="nciicGetCondition", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseElementName="nciicGetConditionResponse", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string CallnciicGetCondition([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense) {
object[] results = this.Invoke("CallnciicGetCondition", new object[] {
inLicense});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginCallnciicGetCondition(string inLicense, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("CallnciicGetCondition", new object[] {
inLicense}, callback, asyncState);
}
/// <remarks/>
public string EndCallnciicGetCondition(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void CallnciicGetConditionAsync(string inLicense) {
this.CallnciicGetConditionAsync(inLicense, null);
}
/// <remarks/>
public void CallnciicGetConditionAsync(string inLicense, object userState) {
if ((this.CallnciicGetConditionOperationCompleted == null)) {
this.CallnciicGetConditionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCallnciicGetConditionOperationCompleted);
}
this.InvokeAsync("CallnciicGetCondition", new object[] {
inLicense}, this.CallnciicGetConditionOperationCompleted, userState);
}
private void OnCallnciicGetConditionOperationCompleted(object arg) {
if ((this.CallnciicGetConditionCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.CallnciicGetConditionCompleted(this, new CallnciicGetConditionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string nciicExactSearch([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inConditions) {
object[] results = this.Invoke("nciicExactSearch", new object[] {
inLicense,
inConditions});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginnciicExactSearch(string inLicense, string inConditions, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("nciicExactSearch", new object[] {
inLicense,
inConditions}, callback, asyncState);
}
/// <remarks/>
public string EndnciicExactSearch(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void nciicExactSearchAsync(string inLicense, string inConditions) {
this.nciicExactSearchAsync(inLicense, inConditions, null);
}
/// <remarks/>
public void nciicExactSearchAsync(string inLicense, string inConditions, object userState) {
if ((this.nciicExactSearchOperationCompleted == null)) {
this.nciicExactSearchOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnciicExactSearchOperationCompleted);
}
this.InvokeAsync("nciicExactSearch", new object[] {
inLicense,
inConditions}, this.nciicExactSearchOperationCompleted, userState);
}
private void OnnciicExactSearchOperationCompleted(object arg) {
if ((this.nciicExactSearchCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.nciicExactSearchCompleted(this, new nciicExactSearchCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string nciicCourt([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inConditions) {
object[] results = this.Invoke("nciicCourt", new object[] {
inLicense,
inConditions});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginnciicCourt(string inLicense, string inConditions, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("nciicCourt", new object[] {
inLicense,
inConditions}, callback, asyncState);
}
/// <remarks/>
public string EndnciicCourt(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void nciicCourtAsync(string inLicense, string inConditions) {
this.nciicCourtAsync(inLicense, inConditions, null);
}
/// <remarks/>
public void nciicCourtAsync(string inLicense, string inConditions, object userState) {
if ((this.nciicCourtOperationCompleted == null)) {
this.nciicCourtOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnciicCourtOperationCompleted);
}
this.InvokeAsync("nciicCourt", new object[] {
inLicense,
inConditions}, this.nciicCourtOperationCompleted, userState);
}
private void OnnciicCourtOperationCompleted(object arg) {
if ((this.nciicCourtCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.nciicCourtCompleted(this, new nciicCourtCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string nciicBirthplaceCompare([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inConditions) {
object[] results = this.Invoke("nciicBirthplaceCompare", new object[] {
inLicense,
inConditions});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginnciicBirthplaceCompare(string inLicense, string inConditions, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("nciicBirthplaceCompare", new object[] {
inLicense,
inConditions}, callback, asyncState);
}
/// <remarks/>
public string EndnciicBirthplaceCompare(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void nciicBirthplaceCompareAsync(string inLicense, string inConditions) {
this.nciicBirthplaceCompareAsync(inLicense, inConditions, null);
}
/// <remarks/>
public void nciicBirthplaceCompareAsync(string inLicense, string inConditions, object userState) {
if ((this.nciicBirthplaceCompareOperationCompleted == null)) {
this.nciicBirthplaceCompareOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnciicBirthplaceCompareOperationCompleted);
}
this.InvokeAsync("nciicBirthplaceCompare", new object[] {
inLicense,
inConditions}, this.nciicBirthplaceCompareOperationCompleted, userState);
}
private void OnnciicBirthplaceCompareOperationCompleted(object arg) {
if ((this.nciicBirthplaceCompareCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.nciicBirthplaceCompareCompleted(this, new nciicBirthplaceCompareCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string nciicAddrExactSearch([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inConditions) {
object[] results = this.Invoke("nciicAddrExactSearch", new object[] {
inLicense,
inConditions});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginnciicAddrExactSearch(string inLicense, string inConditions, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("nciicAddrExactSearch", new object[] {
inLicense,
inConditions}, callback, asyncState);
}
/// <remarks/>
public string EndnciicAddrExactSearch(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void nciicAddrExactSearchAsync(string inLicense, string inConditions) {
this.nciicAddrExactSearchAsync(inLicense, inConditions, null);
}
/// <remarks/>
public void nciicAddrExactSearchAsync(string inLicense, string inConditions, object userState) {
if ((this.nciicAddrExactSearchOperationCompleted == null)) {
this.nciicAddrExactSearchOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnciicAddrExactSearchOperationCompleted);
}
this.InvokeAsync("nciicAddrExactSearch", new object[] {
inLicense,
inConditions}, this.nciicAddrExactSearchOperationCompleted, userState);
}
private void OnnciicAddrExactSearchOperationCompleted(object arg) {
if ((this.nciicAddrExactSearchCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.nciicAddrExactSearchCompleted(this, new nciicAddrExactSearchCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped
)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string nciicCheck([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inConditions) {
object[] results = this.Invoke("nciicCheck", new object[] {
inLicense,
inConditions});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginnciicCheck(string inLicense, string inConditions, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("nciicCheck", new object[] {
inLicense,
inConditions}, callback, asyncState);
}
/// <remarks/>
public string EndnciicCheck(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void nciicCheckAsync(string inLicense, string inConditions) {
this.nciicCheckAsync(inLicense, inConditions, null);
}
/// <remarks/>
public void nciicCheckAsync(string inLicense, string inConditions, object userState) {
if ((this.nciicCheckOperationCompleted == null)) {
this.nciicCheckOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnciicCheckOperationCompleted);
}
this.InvokeAsync("nciicCheck", new object[] {
inLicense,
inConditions}, this.nciicCheckOperationCompleted, userState);
}
private void OnnciicCheckOperationCompleted(object arg) {
if ((this.nciicCheckCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.nciicCheckCompleted(this, new nciicCheckCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string nciicCompare([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inConditions) {
object[] results = this.Invoke("nciicCompare", new object[] {
inLicense,
inConditions});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginnciicCompare(string inLicense, string inConditions, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("nciicCompare", new object[] {
inLicense,
inConditions}, callback, asyncState);
}
/// <remarks/>
public string EndnciicCompare(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void nciicCompareAsync(string inLicense, string inConditions) {
this.nciicCompareAsync(inLicense, inConditions, null);
}
/// <remarks/>
public void nciicCompareAsync(string inLicense, string inConditions, object userState) {
if ((this.nciicCompareOperationCompleted == null)) {
this.nciicCompareOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnciicCompareOperationCompleted);
}
this.InvokeAsync("nciicCompare", new object[] {
inLicense,
inConditions}, this.nciicCompareOperationCompleted, userState);
}
private void OnnciicCompareOperationCompleted(object arg) {
if ((this.nciicCompareCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.nciicCompareCompleted(this, new nciicCompareCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", ResponseNamespace="https://http://www.cnblogs.com/ /nciicGetCondition", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public string nciicCombineSearch([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inLicense, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string inConditions) {
object[] results = this.Invoke("nciicCombineSearch", new object[] {
inLicense,
inConditions});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginnciicCombineSearch(string inLicense, string inConditions, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("nciicCombineSearch", new object[] {
inLicense,
inConditions}, callback, asyncState);
}
/// <remarks/>
public string EndnciicCombineSearch(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void nciicCombineSearchAsync(string inLicense, string inConditions) {
this.nciicCombineSearchAsync(inLicense, inConditions, null);
}
/// <remarks/>
public void nciicCombineSearchAsync(string inLicense, string inConditions, object userState) {
if ((this.nciicCombineSearchOperationCompleted == null)) {
this.nciicCombineSearchOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnciicCombineSearchOperationCompleted);
}
this.InvokeAsync("nciicCombineSearch", new object[] {
inLicense,
inConditions}, this.nciicCombineSearchOperationCompleted, userState);
}
private void OnnciicCombineSearchOperationCompleted(object arg) {
if ((this.nciicCombineSearchCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.nciicCombineSearchCompleted(this, new nciicCombineSearchCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void nciicDiscernCompletedEventHandler(object sender, nciicDiscernCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class nciicDiscernCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal nciicDiscernCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void nciicCheckChinaCompletedEventHandler(object sender, nciicCheckChinaCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class nciicCheckChinaCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal nciicCheckChinaCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void CallnciicGetConditionCompletedEventHandler(object sender, CallnciicGetConditionCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CallnciicGetConditionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal CallnciicGetConditionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void nciicExactSearchCompletedEventHandler(object sender, nciicExactSearchCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class nciicExactSearchCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal nciicExactSearchCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void nciicCourtCompletedEventHandler(object sender, nciicCourtCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class nciicCourtCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal nciicCourtCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void nciicBirthplaceCompareCompletedEventHandler(object sender, nciicBirthplaceCompareCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class nciicBirthplaceCompareCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal nciicBirthplaceCompareCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void nciicAddrExactSearchCompletedEventHandler(object sender, nciicAddrExactSearchCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class nciicAddrExactSearchCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal nciicAddrExactSearchCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void nciicCheckCompletedEventHandler(object sender, nciicCheckCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class nciicCheckCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal nciicCheckCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void nciicCompareCompletedEventHandler(object sender, nciicCompareCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class nciicCompareCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal nciicCompareCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void nciicCombineSearchCompletedEventHandler(object sender, nciicCombineSearchCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class nciicCombineSearchCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal nciicCombineSearchCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
}
有了这个类,最后一步就是实现调取数据了,
try
{
//授权文件内容建议以后放在数据库或是文件里而且要加密
string inliance = @"文件内容";
//生成的WSDL类()
nciicGetCondition objText = new nciicGetCondition();
//基础URL建议加密和写在文件中
objText.Url = "https://www.cnblogs.com/ ";
//编码
objText.RequestEncoding = Encoding.UTF8;
//创建证书文件
X509Certificate objx509 = new X509Certificate(Application.StartupPath + "\\tingting.cer");
//证书
objText.ClientCertificates.Add(objx509);
//方式可有可无
objText.UserAgent = "Client Cert Sample";
//读XML文件
string inConditions = File.ReadAllText(Application.StartupPath + "\\XMLFile1.xml");
//Text文件
this.richTextBox1.Text = objText.nciicCheck(inliance, inConditions);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
到这里我们已经和服务器沟通上了。好,到此,获取数据ing……