0

我正在尝试在 VB.NET 中使用 SOAP 处理 WSDL 请求:

    <AvailabilitySearch> 
<Authority> 
<RegionId>or<HotelId>
 <HotelStayDetails>
 <HotelSearchCriteria>(optional) 
<DetailLevel>(optional) 
<CustomDetailLevel>(optional) 
<MaxResultsPerHotel>(optional, ignored) 
<MaxHotels>(optional)
 <SortOrder>(optional, ignored)
 <MaxSearchTime>(optional, ignored) 
</AvailabilitySearch>

我的编码是:

 Protected Sub btnhotelsearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnhotelsearch.Click
    '----------------------Authority---------------------------
    Dim systemauthority As New com.roomsxmldemo.AuthorityElement

    systemauthority.Currency = "USD"
    systemauthority.Org = "xx"
    systemauthority.User = "xx"
    systemauthority.Password = "xx"
    systemauthority.Version = "1.18"
    '----------------------Authority End---------------------------


    Dim hotelsearch As com.roomsxmldemo.AvailabilitySearch
    hotelsearch.Authority = systemauthority
    hotelsearch.RegionId = 18169
    hotelsearch.HotelId = 0
    hotelsearch.HotelStayDetails.Nights = 1
    hotelsearch.HotelStayDetails.Nationality = "IQ"
    hotelsearch.HotelStayDetails.ArrivalDate = "2014-01-14"


    Dim result As com.roomsxmldemo.AvailabilitySearchResult
    txtresult.Text = result.HotelAvailability.Length

End Sub

在授权语法中出现错误,我传递了所有登录详细信息,但出现以下错误:对象引用未设置为对象的实例。

说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.NullReferenceException:对象引用未设置为对象的实例。

源错误:

Line 84: 
Line 85:         Dim hotelsearch As com.roomsxmldemo.AvailabilitySearch
**Line 86:         hotelsearch.Authority = systemauthority**
Line 87:         hotelsearch.RegionId = 18169
Line 88:         hotelsearch.HotelId = 0
4

1 回答 1

0

尝试这个:

Dim hotelsearch As New com.roomsxmldemo.AvailabilitySearch
于 2013-10-17T01:12:19.367 回答