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