我成功添加了一个webreference到我的asp.net vb web项目。
但我不知道如何进行首次搜索,因为没有文档。
有人可以给我一些关于以下网络服务的提示吗?
http://xml.lowcostgroup.com/soap/book.asmx
相应的请求
<?xml version="1.0" encoding="utf-8"?>
<SearchRequest>
<LoginDetails>
<Login>login</Login>
<Password>pass</Password>
<AgentReference>IRELAND</AgentReference>
</LoginDetails>
<SearchDetails>
<ArrivalDate>2012-08-11</ArrivalDate>
<Duration>7</Duration>
<RegionID>64</RegionID>
<AirportCode>PMI</AirportCode>
<PropertyID>0</PropertyID>
<Resorts>
<Resort>
<ResortID>324</ResortID>
</Resort>
<Resort>
<ResortID>343</ResortID>
</Resort>
<Resort>
<ResortID>347</ResortID>
</Resort>
</Resorts>
<MealBasisID>0</MealBasisID>
<MinStarRating>0</MinStarRating>
<RoomRequests>
<RoomRequest>
<Adults>2</Adults>
<Children>1</Children>
<Infants>0</Infants>
<ChildAges>
<ChildAge>
<Age>5</Age>
</ChildAge>
</ChildAges>
</RoomRequest>
</RoomRequests>
</SearchDetails>
</SearchRequest>
答案 0 :(得分:1)
添加Web服务时,必须在窗口底部的文本框中输入命名空间。在该命名空间内将是您调用服务所需的服务客户端。
例如,如果您使用“BookService”作为命名空间,则代码看起来像这样:
BookService.SearchRequest searchRequest = new BookService.SearchRequest();
// Fill out the search request
BookService.wbBookSoapClient client = new BookService.wbBookSoapClient();
BookService.SearchResponse response = client.Search(searchRequest);
根据您在下方评论中发布的代码,您应该将其更新为如下所示:
ServiceReference1.PropertyDetailsRequest searchRequest = new ServiceReference1.PropertyDetailsRequest();
ServiceReference1.LoginDetails loginDetails = new ServiceReference1.LoginDetails();
loginDetails.Login = "";
loginDetails.Password = "";
loginDetails.AgentReference = "german";
searchRequest.LoginDetails = loginDetails;
searchRequest.PropertyID = 20;
ServiceReference1.wbBookSoapClient client = new ServiceReference1.wbBookSoapClient();
ServiceReference1.PropertyDetailsResponse response = client.PropertyDetails(searchRequest);