Exam Prep Questions

Team-Fly    

Developing XML Web Services and Server Components with Visual C#™ .NET and the .NET Framework, Exam Cram™ 2 (Exam 70-320)
By Amit Kalani, Priti Kalani

Table of Contents
Chapter 5.  Basic Web Services


Question 1

You have used the Web Services Discovery tool to retrieve information about a Web service named ZipcodeService. Which file would contain the URL for any documentation of the ZipcodeService Web service?

  • A. disco.exe

  • B. results.discomap

  • C. ZipcodeService.wsdl

  • D. ZipcodeService.disco

A1:

Answer D is correct. The .disco file is the only one that contains documentation URLs. Answer A is incorrect because disco.exe is the Web Services Discovery tool that discovers the URLs of XML Web services. Answers B and C are incorrect because the .discomap and .wsdl files are XML files that do not contain any documentation URLs.

Question 2

You have used ASP.NET to create a Web service to return financial information. One of the methods in your Web service is defined with the following code:

 public double Cash() {     // Calculations omitted } 

Potential consumers of your Web service report that, although they can set a reference to the Web Service, the Cash() method is not available. What could be the problem?

  • A. The .asmx file for the Web service is not available on your Web server.

  • B. The Web service class is not marked with the [WebService] attribute.

  • C. The Cash() method is not marked with the [WebMethod] attribute.

  • D. Web service methods can return only string values.

A2:

Answer C is correct. All exposed methods of a Web service must be marked with the [WebMethod] attribute. Answer A is incorrect because consumers of the Web service can set a reference to the Web service, and the .asmx file must be available on the server. Answer B is incorrect because the [WebService] attribute is used only to set a namespace for the Web service. Answer D is incorrect because Web service methods can be of any serializable type, including string and double.

Question 3

Your application invokes a Web service named Northwind that includes a Web method named GetOrders(). GetOrders() returns a DataSet object that contains order information. What must you do to use this DataSet object in your client application?

  • A. Create a new DataSet object and use the ReadXml() method of DataSet to initialize it from the returning SOAP message.

  • B. Obtain an XSD file that specifies the schema of the DataSet object. Then use this XSD file to instantiate a DataSet object from the returned data from the GetOrders() method.

  • C. Assign the return value from the GetOrders() method to an array of DataRow variables. Then loop through the array to build the DataSet object.

  • D. Assign the return value from the GetOrders() method to a DataSet variable.

A3:

Answer D is correct. The only thing you need to do to use a complex variable returned by the Web service is to declare an instance of the same data type in the client application. Answers A and B are incorrect because they involve additional efforts. Answer C is incorrect because a DataSet object cannot be mapped to an array of DataRow objects.

Question 4

You have created a new Web service to perform financial calculations. You're working in an ASP.NET project in the Visual Studio .NET environment. What's the easiest way to test your new Web service to ensure that it's returning the proper results?

  • A. Cut and paste the code into a Web application project, and then test it in the new project.

  • B. Run the Web service project and use the test page that is displayed in the browser.

  • C. Use a tool such as WebService Studio to send SOAP requests directly to the server.

  • D. Have a large number of beta testers use the application and monitor the server for odd behavior.

A4:

Answer B is correct. When you're creating a Web service in Visual Studio .NET, running the project opens a testing form in a browser window. Answers A, C, and D are incorrect because these methods require additional efforts.

Question 5

You are using the WSDL tool to create a proxy class for a Web service. The Web service exposes a class named Customer, but you already have a Customer class in your application. What is the best way to allow both classes to coexist in the same application?

  • A. Use the /namespace option of the Web Services Description Language tool to specify a unique namespace for the new class.

  • B. Rename the existing class.

  • C. Use the /out option of the WSDL tool to specify a unique output filename for the new class.

  • D. Manually edit the generated proxy class to change the class name it contains.

A5:

Answer A is correct. Specifying a unique namespace for the new object eliminates the possibility that it could clash with a pre-existing object name. Answer B is incorrect because renaming a class can break other applications that depend on it. Answer C is incorrect because the /out option of the WSDL tool specifies only the file in which to save the generated proxy code, and doing so does not help the coexistence of the given classes. Answer D is incorrect because it requires additional coding efforts.

Question 6

You want to use a Web service that supplies inventory-level information in your application. You know the URL of the .asmx file published by the Web service. Which step should you take first?

  • A. Open the .asmx file in a Web browser.

  • B. Run the XML Schema Definition tool.

  • C. Run the Web Services Discovery tool.

  • D. Copy the .asmx file to your client project.

A6:

Answer C is correct. The Web Services Discovery tool retrieves copies of the files you need to proceed with this project. Answer A is incorrect because opening the .asmx file in the Web browser will not help you in creating client projects to invoke the Web service. Answer B is incorrect because the XML Schema Definition tool will not help you locate WSDL and other files needed to invoke the Web service. Answer D is incorrect because you should not copy the .asmx file to the client project because you might not always have access to the .asmx file.

Question 7

One of your business partners has informed you that he's making his inventory information available via a Web service. You do not know the Web service's URL, so you want to discover it using the least amount of effort. Which of the following actions should you take?

  • A. Use the Web Services Discovery tool to download the information.

  • B. Use the WSDL tool to create a proxy class.

  • C. Use a UDDI registry to locate the Web service.

  • D. Use a search engine to explore your partner's Web site.

A7:

Answer C is correct. UDDI registries exist so that you can find business services by browsing or searching. Answers A and B are incorrect because the Web Services Discovery tool requires you to know the URL of the WSDL contract file (.wsdl), the XSD schema file (.xsd), or the discovery document (.disco) of the Web service. Answer D is incorrect because typical search engines do not provide a direct facility for searching or browsing Web services and can require additional efforts to discover the URL of the Web service.

Question 8

You're using the Web Services Discovery tool to determine information about a Web service on a particular server. You receive the following error message: "The HTML document does not contain Web service discovery information." What could be the most likely cause of this problem?

  • A. The server address you typed does not exist.

  • B. The server requires authentication, and you have entered improper credentials.

  • C. The Web Services Discovery tool works only for services on your local computer.

  • D. No WSDL or Disco file is available at the address you typed.

A8:

Answer D is correct. The Web Services Discovery tool requires the URL to a Disco or WSDL file to function. Answer A is incorrect because, according to the information presented, you can reach the Web server, but the document you are requesting does not contain Web service discovery information. Answer B is incorrect because, if authentication fails, you get a different error message. Answer C is incorrect because the Web Services Discovery tool can access Web services on local as well as remote servers.

Question 9

Your application includes a Web reference to a Web service that delivers customer information as an object with multiple properties. The developer of the Web service has added a new property named CreditRating to the object. You want to use the CreditRating property in your code with the least amount of effort. Which of the following actions should you take?

  • A. Create an entirely new client application, and then add to the new application a Web reference for the Web service.

  • B. Delete and re-create the Web reference in the existing application.

  • C. Update the Web reference in the existing application.

  • D. Use a generic Object variable to hold customer information so that you can call any property you want.

A9:

Answer C is correct. The Update Web Reference menu item for a Web reference refreshes local configuration information from the server that hosts the Web service. Answers A, B, and D are incorrect because these actions require additional efforts to complete.

Question 10

Your application calls a Web service that performs complex, time-consuming calculations. Users complain that the user interface of the application freezes while it's recalculating. Which approach is guaranteed to solve this problem?

  • A. Move the application to a faster computer.

  • B. Install a faster link to the Internet.

  • C. Install more memory in the computer.

  • D. Use asynchronous calls to invoke the Web service.

A10:

Answer D is correct. An asynchronous call to invoke the Web service returns the control to the user without waiting for the complete execution of the Web service. This approach of invoking Web services assists in making the user interface responsive. Answers A, B, and C are incorrect because speeding up the client computer does nothing to speed up the Web service, which runs on the server computer.


    Team-Fly    
    Top


    MCAD Developing XML Web Services and Server Components with Visual C#. NET and the. NET Framework Exam Cram 2 (Exam Cram 70-320)
    Managing Globally with Information Technology
    ISBN: 789728974
    EAN: 2147483647
    Year: 2002
    Pages: 179

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net