读书人

使用webservice的有关问题

发布时间: 2012-09-06 10:37:01 作者: rapoo

使用webservice的问题
[code=HTML][/code]

C# code
[System.Web.Services.WebServiceBindingAttribute(Name = "HelloWorld", Namespace = "http://tempuri.org/")]public partial class Soap : System.Web.Services.Protocols.SoapHttpClientProtocol{    public Soap()    {        this.Url = "http://localhost/webservice.asmx";    }    public DateTime GetDate()    {        object[] results = this.Invoke("HelloWorld", new object[] { });        return ((DateTime)(results[1]));    }}

我用这个获取数据的时候出错
HTML code
异常详细信息: System.ArgumentException: HelloWorld Web 服务方法名无效。源错误: 行 65:     public DateTime GetDate()行 66:     {行 67:         object[] results = this.Invoke("HelloWorld", new object[] { });行 68:         return ((DateTime)(results[1]));行 69:     } 


是什么问题
HelloWorld是有的啊
在webservice.asmx中测试没有问题
请教了

[解决办法]
HelloWorld应该是个方法

读书人网 >Web Service

热点推荐