引用国外的一个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 )
什么问题呢.
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 )
什么问题呢.
myRoomInfo[0] = new HS.RommInfo();
myRoomInfo[0].AdultsNum=2;//出问题的这行.
myRoomInfo[0].ChildNum=0;
myRoomInfo[0].ChildAges=ChildAges;
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());错误提示一样.
^^^^^^此为一个 异步调用的 返回结果, 执行后,并一定会立即返回结果, 该WEBSERVICE 应该还有其他的异步触发事件才对
_1btest.HS.HotelsService 的成员