引用国外的一个WEB SERVCIE.代码如下:HS.HotelsService myHotelsService=new HS.HotelsService();
HS.LoginHeader myLoginHeader=new HS.LoginHeader();
myLoginHeader.username="aaaaaa";
myLoginHeader.password="111111";
myHotelsService.LoginHeaderValue=myLoginHeader;//到这里没有问题,调用其它的METHOD也可以.
DateTime check_in,check_out;
int[] ChildAges=new int[1];
ChildAges[0]=0;check_in=Convert.ToDateTime("2005-06-12");
check_out=Convert.ToDateTime("2005-06-17");HS.RoomInfo[] myRoomInfo=new HS.RoomInfo[1];
myRoomInfo[0].AdultsNum=2;//出问题的这行.
myRoomInfo[0].ChildNum=0;
myRoomInfo[0].ChildAges=ChildAges;

decimal maxPrice,starLevel;
starLevel=0m;
maxPrice=0m;
myHotelsService.SearchHotels("SFO","San Francisco","San Francisco - Airport Area","",check_in,check_out,myRoomInfo,maxPrice,starLevel,true);这行出错,提示未将对象引用设置到对象的实例
myRoomInfo[0].AdultsNum=2;另SearchHotels说明为
public System.IAsyncResult BeginSearchHotels ( System.String sDestination , System.String sHotelCityName , System.String sHotelLocationName , System.String sHotelName , System.DateTime dtCheckIn , System.DateTime dtCheckOut , _1btest.HS.RoomInfo[] roomsInformation , System.Decimal maxPrice , System.Decimal starLevel , System.Boolean fAvailableOnly , System.AsyncCallback callback , System.Object asyncState )
什么问题呢.

解决方案 »

  1.   

    HS.RoomInfo[] myRoomInfo=new HS.RoomInfo[1];
    myRoomInfo[0] = new HS.RommInfo();
    myRoomInfo[0].AdultsNum=2;//出问题的这行.
    myRoomInfo[0].ChildNum=0;
    myRoomInfo[0].ChildAges=ChildAges;
      

  2.   

    谢谢 JasonHeung(拥有一切也不过就这样笑着哭) 又出现了相同的提示错误,但不是这行.下面的写法可以
    myHotelsService.SearchHotels("SFO","San Francisco","San Francisco - Airport Area","",check_in,check_out,myRoomInfo,maxPrice,starLevel,true);
    我输出返回结果的时候就出错.Response.Write (myHotelsService.SearchHotels("SFO","San Francisco","San Francisco-Airport Area"," ",check_in,check_out,myRoomInfo,maxPrice,starLevel,false).GetXml().ToString());错误提示一样.
      

  3.   

    public System.IAsyncResult BeginSearchHotels ......
                    ^^^^^^此为一个 异步调用的 返回结果, 执行后,并一定会立即返回结果, 该WEBSERVICE 应该还有其他的异步触发事件才对
      

  4.   

    三角猫,上面写错了.上面写的是BeginSearchHotels,而我用的是SearchHotels.public _1btest.HS.TWS_HotelList SearchHotels ( System.String sDestination , System.String sHotelCityName , System.String sHotelLocationName , System.String sHotelName , System.DateTime dtCheckIn , System.DateTime dtCheckOut , _1btest.HS.RoomInfo[] roomsInformation , System.Decimal maxPrice , System.Decimal starLevel , System.Boolean fAvailableOnly )
        _1btest.HS.HotelsService 的成员
      

  5.   

    异步调用如何作呢.他有一个BEGIN和ENG相应的METHOD.