所以我有一个用于发出 SOAP 请求的 web url(一些 ip 地址)/SpecialService.asmx?op=GetAllBonuses。当我将它插入 Chrome 时,/SpecialService.asmx?op=GetAllBonuses&(credentials pass in),我得到了我的数据。但是,当我将 url 作为 Web 参考添加到 Visual Studio 并使用生成的类时,我没有得到任何结果。任何想法?我希望这是有道理的,因为我不完全确定如何解释它。编辑: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);