WebService学习:.Net调用Java编写WebService(2)
这里把生成的代理类代码给大家贴出来:
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.573
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
//
// 此源代码是由 Microsoft.VSDesigner 1.1.4322.573 版自动生成。
//
namespace JavaWebService {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/**//// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="VChargeBinding", Namespace="http://csdfsn.esfig/javaservice")]
public class VChargeService : System.Web.Services.Protocols.SoapHttpClientProtocol {
/**//// <remarks/>
public VChargeService() {
this.Url = "https://www.csdfsn.cn/cma/javaService?wsdl";
}
/**//// <remarks/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace="http://csdfsn.esfig/javaservice", ResponseNamespace="http://csdfsn.esfig/javaservice")]
[return: System.Xml.Serialization.SoapElementAttribute("result")]
public string doservice(string String_1) {
object[] results = this.Invoke("doservice", new object[] {
String_1});
return ((string)(results[0]));
}
/**//// <remarks/>
public System.IAsyncResult Begindovcharge(string String_1, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("doservice", new object[] {
String_1}, callback, asyncState);
}
/**//// <remarks/>
public string Enddoservice(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/**//// <remarks/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace="http://csdfsn.esfig/javaservice", ResponseNamespace="http://csdfsn.esfig/javaservice")]
[return: System.Xml.Serialization.SoapElementAttribute("result")]
public string docheck(string String_1) {
object[] results = this.Invoke("docheck", new object[] {
String_1});
return ((string)(results[0]));
}
/**//// <remarks/>
public System.IAsyncResult Begindocheck(string String_1, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("docheck", new object[] {
String_1}, callback, asyncState);
}
/**//// <remarks/>
public string Enddocheck(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
}
}
可以看到,这个代理类和引用.net的WebService生成的代理类没有什么区别,此时下面的工作就和用.Net的WebService就一样了
在此说明一下生成代理类还可以使用其它的方法,如wsdl等,最后的结果都是一样的。
通过这个例子,不同网站语言编写的东西调用还不是很难哦。

