Chapter 25 – Windows Communication Foundation (WCF) Web Services in VB
25.1 Introduction
1. Which of the following is false?
a) WCF is a set of technologies for building distributed systems in which system components communicate with one another over networks.
b) Since WCF is a common framework for all communication between systems, it allows you to learn only one programming model to use WCF.
c) Web services promote software reusability in distributed systems that typically execute across the Internet.
d) Web services allow its methods to be called by methods on other machines via different data formats and protocols.
Answer: d
2. Aweb service’s methods can be called by methods on other machines using ______.
a) Representational State Transfer (REST) architecture
b) Simple Object Access Protocol
c) Both (a) and (b).
d) None of the above.
Answer: c
25.2 WCF Services Basics
1. All of the following are key components of a WCF service except:
a) contract
b) operation
c) address
d) binding
Answer: b
2. The machine on which the web service resides is commonly referred to as the ______.
a) web service host
b) service machine
c) web machine
d) None of the above.
Answer: a
25.3 Simple Object Access Protocol (SOAP)
1. SOAP is based on ______.
a) HTML
b) XML
c) HTTP
d) All of the above
Answer: b
2. Each SOAP call is packaged in an XML message called a SOAP ______
a) envelope
b) packet
c) transfer
d) None of the above
Answer: a
25.4 Representational State Transfer (REST)
1. Each operation in a RESTful web service is identified by a unique ______.
a) URL
b) proxy object
c) interface
d) None of the above
Answer: a
2. REST-based web services differ from SOAP-based web services in that ______.
a) REST operations must be accessed through a web service proxy object
b) REST services are less verbose than SOAP-based services
c) the request and response of REST services are not wrapped in envelopes and are not necessarily in XML format
d) None of the above.
Answer: c
25.5 JavaScript Object Notation (JSON)
1. The JSON format is ______compared to the XML format.
a) of higher quality
b) more verbose
c) less verbose
d) None of the above
Answer: c
2. JSON is a text-based data-interchange format used to represent objects in JavaScript as collections of ______represented as strings.
a. data/format pairs
b. primary key/data rows
c. definition/key pairs
d. name/value pairs
Answer: d
25.6 Publishing and Consuming SOAP-Based WCF Web Services
1. A WCF web service in Visual Web Developer consists of ______.
a) a code-behind file
b) a Web.config file
c) an SVC file
d) All of the above
Answer: d
2. An application that consumes a SOAP-basedweb service consists of a ______class and a ______application.
a) client, virtual
b) proxy, client
c) virtual, proxy
d) user, proxy
Answer: b
25.7 Publishing and Consuming REST-Based XML Web Services
1. The ______attribute maps a method to a unique URL that can be accessed via an HTTP GET operation programmatically or in a web browser.
a) OperationContract
b) WebGet
c) OperationBinding
d) UriTemplate
Answer: b
2. In the Web.config file, the service binding in the endpoint element must be set to ______to support REST-based HTTP requests.
a) webHttpBinding
b) wsHttpBinding
c) basicHttpBinding
d) netHttpBinding
Answer: a
25.8 Publishing and Consuming REST-Based JSON Web Services
1. For a WCF web service to return data in JSON format, WebGet’s ResponseFormat property must be set to ______.
a) WebMessageFormat.Json
b) MessageFormat.Json
c) an SVC file
d) All of the above
Answer: a
2. The ______attribute exposes a class to client access.
a) DataEndpoint
b) DataBinding
c) DataMember
d) DataContract
Answer: d
25.9 Blackjack Web Service: Using Session Tracking in a SOAP-Based WCF Web Service
1. Once the user’s information is stored in a session variable, ______.
a) web methods can return personalized and localized results
b) the application will perform better because less information needs to pass between the client and the server.
c) Both (a) and (b).
d) None of the above.
Answer: d
2. To have the same object of a web service class handle all calls to the service, the ServiceBehavior attribute’s InstanceContextMode must be set to ______.
a) PerSession
b) Single
c) PerCall
d) PerInstance
Answer: b
25.10 Airline Reservation Web Service: Database Access and Invoking a Service from ASP.NET
(no questions)
25.11 Equation Generator: Returning User-Defined Types
1. An XML data object is converted to a custom type via the process of ______.
a) deserialization
b) SOAP decoding
c) typecasting
d) None of the above.
Answer: a
2. Which is a not requirement of a custom data type to be used in web services?
a) Any variables to be accessed during runtime must be declared WebVar.
b) The class with the web methods must provide a Public default constructor.
c) Properties and instance variables that should be serialized must be declared Public.
d) Properties that should be serialized must provide both get and set accessors.
Answer: a