Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

Workshop

The workshop is designed to help you review what you've learned in this hour and to prepare you for the material that will be covered in future hours. The answers to the quiz are in Appendix A.

Quiz

  1. You have created an XML Web service that compiles correctly but when run exposes no methods. Why?

    1. You forgot to include the <WebMethod()> declaration in your code.

  2. Why is it important to create a new WSDL file after deploying your XML Web service?

    1. The original WSDL file points to your development server, not the location where the service has been deployed.

  3. You need to close down a connection to a database and drop some object references. Where should this be done?

    1. The Dispose() method is where XML Web services do their cleanup.

Exercises

Experiment with the four-function calculator. Try creating other simple mathematical functions, such as squaring an integer, returning the sine and cosine of a number, or returning the value of pi to some user-requested number of decimal places. You can cheat on that last function by simply storing pi as a constant of some arbitrary length and rounding it to fit the user's request.

  1. The following code could be added to your FourFunctionCalc code to create a squaring function:

    1:   	 <WebMethod()> Public Function Squared(iNum1 as Integer) _
    2:            		 As Long
    3:
    4:     		 Return (iNum1 * iNum1)
    5:	 End Function

    It must be noted that the FourFunctionCalc is now grossly misnamed.

  • + Share This
  • 🔖 Save To Your Account