Skip to main content
 首页 » 编程设计

c#之使用 Web 服务响应

2024年02月02日28jirigala

我的页面必须通过以下调用从 Web 服务获得响应:

GetModBook.InvService.InventoryServiceClient isc = new GetModBook.InvService.InventoryServiceClient(); 
 
GetModBook.InvService.GetModBookingsOperationRequest gmoreq = new GetModBook.InvService.GetModBookingsOperationRequest(); 
 
GetModBook.InvService.GetModBookingsOperationResponse gmores = new GetModBook.InvService.GetModBookingsOperationResponse(); 

GetModBookingsOperationResponse 有一个名为 Bookings 的字段,其中包含这样的 Bookings 数组

public GetModBookingsOperationResponse  
{ 
  public Booking Bookings; 
} 

我使用过网络服务的请求部分

例子:

gmoreq.RatePackages = new GetModBook.InvService.GetModBookingsOperationRequest[NoofRatePackages] 

编辑:

Calling a web service

但是我不知道怎么调用响应部分

如有任何建议,我们将不胜感激。

编辑:

GetModBookingsResponse GetModBookings(GetModBookingsRequest request) 

请您参考如下方法:

这里是你如何得到回应

GetModBook.InvService.InventoryServiceClient isc = new GetModBook.InvService.InventoryServiceClient(); 
 
GetModBook.InvService.GetModBookingsOperationRequest gmoreq = new GetModBook.InvService.GetModBookingsOperationRequest(); 
//set the request parameters if there any 
 
GetModBook.InvService.GetModBookingsOperationResponse gmores =isc.GetModBookings(gmoreq);