30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 21 ASP .<strong>NET</strong> and Web Services 1095<br />

21.2 a) SOAP message. b) WebService. c) code-behind. d) WebClient. e) HTTP.<br />

f) Description. g) XML serialization. h) domain.<br />

EXERCISES<br />

21.3 Create a Web service that s<strong>to</strong>res phone-book entries in a database. Give the user the capability<br />

<strong>to</strong> enter new contacts and <strong>to</strong> find contacts by last name. Pass only primitive types as arguments <strong>to</strong><br />

the Web service.<br />

21.4 Modify Exercise 21.3 so that it uses a class named PhoneBookEntry. The client application<br />

should provide objects of type PhoneBookEntry <strong>to</strong> the Web service when adding contacts and<br />

should receive objects of type PhoneBookEntry when searching for contacts.<br />

21.5 Modify the Blackjack Web service example in Section 21.5 <strong>to</strong> include a class Card. Have<br />

DealCard return an object of type Card. Also have the client application keep track of what cards<br />

have been dealt, using Cards. Your card class should include properties <strong>to</strong> determine the face and<br />

suit of the card.<br />

21.6 Modify the airline reservation example in Section 21.6 so that it contains two separate Web<br />

methods—one that allows users <strong>to</strong> view all available seats, and another that allows them <strong>to</strong> reserve<br />

seats. Use an object of type Ticket <strong>to</strong> pass information <strong>to</strong> and from the Web service. This Web application<br />

should list all available seats in a ListBox and then allow the user <strong>to</strong> click a seat <strong>to</strong> reserve<br />

it. Your application must be able <strong>to</strong> handle cases where two users view available seats, one reserves<br />

a seat, and then the second user tries <strong>to</strong> reserve the same seat not knowing that the database has<br />

changed since the page was loaded.<br />

21.7 Modify the TemperatureServer example in Section 21.7 so that it returns an array of<br />

CityWeather objects that the client application uses <strong>to</strong> display the weather information.<br />

21.8 Modify the Web service in the math-tu<strong>to</strong>r example in Section 21.8 so that it includes a method<br />

that calculates how “close” the player is <strong>to</strong> the correct answer. The client application should provide<br />

the correct answer only after a user has offered numerous answers that were far from the correct<br />

one. Use your best judgement regarding what constitutes being “close” <strong>to</strong> the right answer. Remember<br />

that there should be a different formula for 1-digit, 2-digit and 3-digit numbers. Also, give the<br />

program the capability <strong>to</strong> suggest <strong>to</strong> users that they try a lower difficulty level if the users are consistently<br />

wrong.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!