Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Microsoft C# Professional Projects - Premier Press.pdf
Скачиваний:
177
Добавлен:
24.05.2014
Размер:
14.65 Mб
Скачать

638 Project 5 CREATING A WEB PORTAL FOR A BOOKSTORE

Testing the SampleWebService Web Service

As already discussed, the Web service does not have an interface. However, to test the Web service, Visual Studio .NET launches the Web service in Internet Explorer. I will now discuss the steps to test SampleWebService.

To test the SampleWebService Web service, click on the Debug menu, and then select the Start option. Alternatively, you can press the F5 key to debug and run

the Web service.

 

 

 

Y

 

 

 

L

Visual Studio .NET launches the Web service in the Internet Explorer window,

as shown in Figure 28-8.

 

F

 

 

 

 

 

 

M

 

 

 

A

 

 

E

 

 

T

 

 

FIGURE 28-8 The Service1.asmx page for SampleWebService

In addition to the description of the Web service and the Web method, the Service1.asmx page contains a link to call the GetDay() method. To access the Web method, click on the link.

When you click on the link in the Service1.asmx page, the Service1.asmx page for the GetDay() method is displayed. To execute the GetDay() method, you need to pass a date as a parameter to the GetDay() method and click on the Invoke button. Figure 28-9 shows a parameter passed to the GetDay() method.

Team-Fly®

EXPLORING ASP.NET WEB SERVICES

Chapter 28

639

 

 

 

 

FIGURE 28-9 The parameter specified in the GetDay() method

The result returned by the SampleWebService Web service is displayed. Figure 28-10 shows the result returned by the Web method.

FIGURE 28-10 The result returned by the GetDay() method