0

我成功地为我的 asp.net vb web 项目添加了一个 webreference。

但我不知道如何进行第一次搜索,因为没有文档。

有人可以给我一些关于以下网络服务的提示吗?

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>
4

1 回答 1

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);
于 2012-07-11T15:15:23.377 回答