Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Soap请求可以在浏览器中工作,但不能在代码中工作_C#_Visual Studio 2010_Soap - Fatal编程技术网

C# Soap请求可以在浏览器中工作,但不能在代码中工作

C# Soap请求可以在浏览器中工作,但不能在代码中工作,c#,visual-studio-2010,soap,C#,Visual Studio 2010,Soap,因此,我有一个web url(一些ip地址)/SpecialService.asmx?op=GetAllBounders,用于发出SOAP请求。当我把它插入Chrome,/SpecialService.asmx?op=GetAllBonuses&(传入的凭据)时,我就可以取回我的数据。但是,当我将url添加到visual studio作为web引用并使用生成的类时,我不会得到任何结果。有什么想法吗?我希望这是有意义的,因为我不完全确定如何解释它。。 编辑:Visual Studio在名为Spec

因此,我有一个web url(一些ip地址)/SpecialService.asmx?op=GetAllBounders,用于发出SOAP请求。当我把它插入Chrome,/SpecialService.asmx?op=GetAllBonuses&(传入的凭据)时,我就可以取回我的数据。但是,当我将url添加到visual studio作为web引用并使用生成的类时,我不会得到任何结果。有什么想法吗?我希望这是有意义的,因为我不完全确定如何解释它。。 编辑:Visual Studio在名为SpecialService的类下生成的代码

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://phoenixservice3.loyaltylane.com/SpecialService/GetAllBonuses", RequestNamespace="http://phoenixservice3.loyaltylane.com/SpecialService", ResponseNamespace="http://phoenixservice3.loyaltylane.com/SpecialService", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public Bonus[] GetAllBonuses(string userName, string password, System.DateTime date, string storeNumber) {
        object[] results = this.Invoke("GetAllBonuses", new object[] {
                    userName,
                    password,
                    date,
                    storeNumber});
        return ((Bonus[])(results[0]));
    }
然后我这样称呼它:

Bonus[] grabbed = SpecialService.GetAllBonuses(userName, password, DateTime.Today, storeNumber);

你能提供你正在使用的代码吗?如果没有它,我们就无法准确判断问题出在哪里。我已经添加了由web引用生成的代码,以及我使用的代码行。这会有帮助吗?你能不能也展示一下你如何构建
SpecialService
?您是否从浏览器中访问的同一URL添加了web引用?是。我使用相同的url进行web引用。