public string AuthCode(string SourceString, string Key) {
object[] results = this.Invoke("AuthCode", new object[] {
SourceString,
Key});
return ((string)(results[0]));
}
/// <res/>
public System.IAsyncResult BeginAuthCode(string SourceString, string Key, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("AuthCode", new object[] {
SourceString,
Key}, callback, asyncState);
}
/// <res/>
public string EndAuthCode(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
这个是WEB引用后出来的东西我不懂,请问下这三个的用处,
object[] results = this.Invoke("AuthCode", new object[] {
SourceString,
Key});
return ((string)(results[0]));
}
/// <res/>
public System.IAsyncResult BeginAuthCode(string SourceString, string Key, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("AuthCode", new object[] {
SourceString,
Key}, callback, asyncState);
}
/// <res/>
public string EndAuthCode(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
这个是WEB引用后出来的东西我不懂,请问下这三个的用处,
比如 这个web引用 里面很多方法都是异步调用用的,如果不需要其实可以修改
源文件在web引用下的Reference.cs文件
//------------------------------------------------------------------------------
// <auto-generated>
// このコードはツールによって生成されました。
// ランタイム バージョン:2.0.50727.832
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします。
// </auto-generated>
//------------------------------------------------------------------------------//
// このソース コードは Microsoft.VSDesigner、バージョン 2.0.50727.832 によって自動生成されました。
//
#pragma warning disable 1591namespace WindowsApplication1.localhost {
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;
/// <res/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="ServiceSoap", Namespace="http://tempuri.org/")]
public partial class Service : System.Web.Services.Protocols.SoapHttpClientProtocol {
private System.Threading.SendOrPostCallback HelloWorldOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <res/>
public Service() {
this.Url = global::WindowsApplication1.Properties.Settings.Default.WindowsApplication1_localhost_Service;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
public new string Url {
get {
return base.Url;
}
set {
if ((((this.IsLocalFileSystemWebService(base.Url) == true)
&& (this.useDefaultCredentialsSetExplicitly == false))
&& (this.IsLocalFileSystemWebService(value) == false))) {
base.UseDefaultCredentials = false;
}
base.Url = value;
}
}
public new bool UseDefaultCredentials {
get {
return base.UseDefaultCredentials;
}
set {
base.UseDefaultCredentials = value;
this.useDefaultCredentialsSetExplicitly = true;
}
}
/// <res/>
public event HelloWorldCompletedEventHandler HelloWorldCompleted;
/// <res/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/HelloWorld", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string HelloWorld() {
object[] results = this.Invoke("HelloWorld", new object[0]);
return ((string)(results[0]));
}
/// <res/>
public void HelloWorldAsync() {
this.HelloWorldAsync(null);
}
/// <res/>
public void HelloWorldAsync(object userState) {
if ((this.HelloWorldOperationCompleted == null)) {
this.HelloWorldOperationCompleted = new System.Threading.SendOrPostCallback(this.OnHelloWorldOperationCompleted);
}
this.InvokeAsync("HelloWorld", new object[0], this.HelloWorldOperationCompleted, userState);
}
private void OnHelloWorldOperationCompleted(object arg) {
if ((this.HelloWorldCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.HelloWorldCompleted(this, new HelloWorldCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <res/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
}
private bool IsLocalFileSystemWebService(string url) {
if (((url == null)
|| (url == string.Empty))) {
return false;
}
System.Uri wsUri = new System.Uri(url);
if (((wsUri.Port >= 1024)
&& (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
return true;
}
return false;
}
}
/// <res/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
public delegate void HelloWorldCompletedEventHandler(object sender, HelloWorldCompletedEventArgs e);
/// <res/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class HelloWorldCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal HelloWorldCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <res/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
}#pragma warning restore 1591
可以修改成这样//------------------------------------------------------------------------------
// <auto-generated>
// このコードはツールによって生成されました。
// ランタイム バージョン:2.0.50727.832
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします。
// </auto-generated>
//------------------------------------------------------------------------------//
// このソース コードは Microsoft.VSDesigner、バージョン 2.0.50727.832 によって自動生成されました。
//
#pragma warning disable 1591namespace WindowsApplication1.localhost {
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;
/// <res/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "ServiceSoap", Namespace = "http://tempuri.org/")]
public partial class Service : System.Web.Services.Protocols.SoapHttpClientProtocol
{ /// <res/>
public Service()
{
this.Url = "http://localhost:1718/WebSite1/Service.asmx"; }
/// <res/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/HelloWorld", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string HelloWorld()
{
object[] results = this.Invoke("HelloWorld", new object[0]);
return ((string)(results[0]));
}
}
}#pragma warning restore 1591