winform 如何动态引用Webservice 我编写好一个Webservice 后 Winfrom 引用这个WebService 即可使用其中的方法如果WebService 的IP变了 就要重新 引用没什么办法能够直接改为WebService 的IP 实现动态引用谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 添加Web引用. 引用名称改了. 比如MyService 就像实例化普通类的对象一样 使用他. cstester 正解鉴定完毕~ 配置相关信息到XML,获取XML中值实现调用 using System;using System.Collections.Generic;using System.Text;using System.Web.Services.Protocols;using System.Configuration;namespace Service{ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name = "ServiceSoap", Namespace = "http://tempuri.org/")] internal class ServiceProxy : SoapHttpClientProtocol { public ServiceProxy() { //this.Url = ConfigurationManager.AppSettings["Url"]; } [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Server1", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public System.Data.DataSet Server1(string strObjType, string strObjValues) { object[] results = this.Invoke("Server1", new object[] { strObjType, strObjValues}); return ((System.Data.DataSet)(results[0])); } [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Server2", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public System.Data.DataSet Server2(string strObjType, string strObjValues) { object[] results = this.Invoke("Server2", new object[] { strObjType, strObjValues}); return ((System.Data.DataSet)(results[0])); } }} 如果你使用反射来调用可以参考.http://blog.csdn.net/zgke/archive/2009/03/04/3955490.aspx 调用时候用以下语句 using (ServiceProxy proxy = new ServiceProxy()) { proxy.Url = ConfigurationManager.AppSettings["Url"]; DataSet ds = proxy.Server1("USERS", cardID); } 看你用的2003还是2005或是2008了.2003下面动态引用很麻烦.要通过代码生成引用代码,并编译2005下面可直接能WEBSERVER的属性URL进行修改就行了如S_schoolManage.Url = "http://111,222,23,56/schoolmanage.asmx" 反射调用~~~在baidu里面搜搜,有很多~~~ 可以不生成程序集,直接调用WebService吗? C#,asp.net,vs2010,SQL Server,LInq...视频教学资料下载 asp.net模块划分和调用 for each 的vb.net转C# caojinrong提到过可以用.net将网页另存成图片,如何实现? 万年历的代码,有点问题,请大家分析一下 哪位仁兄告诉我有关图象处理的信息 请教各位,关于远程下载网页数据的问题 80分求:导出Excel问题! C#怎么通过WebService 上传图片 请问如何使鼠标聚焦到winform的一个textbox上? js打印的原理 dataGridView显示问题求下面代码的实例
就像实例化普通类的对象一样 使用他.
鉴定完毕~
using System.Collections.Generic;
using System.Text;
using System.Web.Services.Protocols;
using System.Configuration;namespace Service
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "ServiceSoap", Namespace = "http://tempuri.org/")]
internal class ServiceProxy : SoapHttpClientProtocol
{
public ServiceProxy()
{
//this.Url = ConfigurationManager.AppSettings["Url"];
} [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Server1", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Data.DataSet Server1(string strObjType, string strObjValues)
{
object[] results = this.Invoke("Server1", new object[] {
strObjType,
strObjValues});
return ((System.Data.DataSet)(results[0]));
} [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Server2", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Data.DataSet Server2(string strObjType, string strObjValues)
{
object[] results = this.Invoke("Server2", new object[] {
strObjType,
strObjValues});
return ((System.Data.DataSet)(results[0]));
}
}
}
http://blog.csdn.net/zgke/archive/2009/03/04/3955490.aspx
using (ServiceProxy proxy = new ServiceProxy())
{
proxy.Url = ConfigurationManager.AppSettings["Url"];
DataSet ds = proxy.Server1("USERS", cardID);
}
2003下面动态引用很麻烦.要通过代码生成引用代码,并编译
2005下面可直接能WEBSERVER的属性URL进行修改就行了如S_schoolManage.Url = "http://111,222,23,56/schoolmanage.asmx"
在baidu里面搜搜,有很多~~~