Introduction

The field of computing is young relative to other science and engineering disciplines. The rate of innovation and change in the field is staggering and shows no indication of slowing down. Every few years a technology comes along that generates a lot of excitement in the IT industry, and that excitement sometimes spreads to the business community and the popular press. XML Web services are one of the latest technologies to receive such attention.

If you believe the hype, XML Web services are going to change the face of computing and will even influence the way in which we live. XML Web Services will enable unparalleled levels of platform-independent system interoperability; they are a stepping-stone to a world in which every person and every device can intelligently interact, share information, and coordinate activities.

Throughout our careers, we have seen many technologies announced as the next thing to change the world. Some do, while others fail to realize the dreams of their creators and silently drift away to lurk in the dark corners of computing. We believe XML Web services will be a success, and although some of the wilder claims may prove unrealistic, it is a certainty that XML Web services will be a major facet of computing for years to come.

The time is ripe for a technology that delivers the capabilities promised by XML Web services. The popularization and explosive adoption of the Internet over the last 5 years has brought a new appreciation, if not an understanding, of computing to a large section of society. Many people are now comfortable with browsers, surfing the Web and using search engines; they regularly use the Internet to read the news, search for information, and communicate with each other using e-mail and instant messaging. Computer hardware is more accessible than ever and continues to increase in performance; individuals regularly have access to the Internet via high-bandwidth connections that not so long ago were unfeasible for any but the largest companies.

People are receptive to new ways of using technology to save time and money as well as for pleasure. Consumers already use the Web for all manner of activities such as playing games, booking holidays, paying bills, and trading shares. Companies have not only an opportunity but also an obligation to consider the needs of this growing and increasingly sophisticated connected community. We are only in the early days of Web-based service delivery, but competition is already fierce. Companies must provide timely and compelling services to their customers or risk losing them to a competitor.

At the same time, companies recognize the benefits of a closer relationship with business partners, a tighter integration of business processes, and a free flow of information. XML Web services provide a common technology solution that will allow companies to provide new and innovative services, either to target their customers or to provide better integration with their business partners.

Having the right market conditions and commercial drivers provides a positive environment for XML Web services technology to succeed. However, the strongest signal for the future success of XML Web services is the broadly consensual view across the IT industry that XML Web services are a key component of the future of computing. Every technology has its proponents and detractors, and the companies and organizations that back a new technology have a dramatic effect on its success. XML Web services have the backing of most large technology organizations.

Each organization involved in the field of XML Web services has its own vision and reasons for participating; there are many competing views on exactly what constitutes an XML Web service, how they should be developed and deployed, and how they should be used. However, all participants agree on the fundamental principles and the core protocols at the heart of the XML Web service initiative. This broad agreement on protocols and principles encourages confidence in the XML Web service technology.

Finally, it is worth pointing out that XML Web services are not a revolutionary technology that has sprung from nowhere to prominence. Some of the technological foundations of XML Web services have been around for decades. These include the core Internet protocols, distributed computing principles, and component-based development. More important, the core XML Web services technologies are developed in an open, collaborative environment, driven by the knowledge of a broad cross section of the academic and business community. This is a proven approach; one needs only to look at the success of the Internet and the World Wide Web.

Why We Wrote This Book

XML Web services are one of the most interesting and discussed aspects of contemporary computing. Rarely has such an abundance of information about a relatively new technology been so readily accessible. The information available includes detailed technical specifications, architectural models, extensive implementation examples and sample code, programming tutorials, and untold amounts of marketing material. However, the information is of inconsistent quality and suffers from an all too frequent blur between technology and marketing. For the developer wanting to learn about the development of XML Web services, determining where to begin can be difficult.

Our goal in writing this book is not to provide an exhaustive reference for XML Web services or to provide detailed analysis of the related technologies and standards. Doing so would take many volumes. We wrote this book to dispel the complexity, confusion, and hype surrounding XML Web services and teach readers how to develop them for the Microsoft .NET Framework. After working through this book, a programmer will be fully equipped with an understanding of XML Web services and a detailed knowledge of how to create them. From that point, the programmer can begin further exploration of the topic, building the hands-on experience and confidence that no book can teach.

Who Should Read This Book

Predominantly, this book is written for programmers who want to create XML Web services to run on the Microsoft .NET Framework. Part I includes a high-level introduction to XML Web services. This introduction assumes a familiarity with the Internet and with principles of software development; however it is neither overly technical nor complex. These chapters will provide a valuable overview for any reader interested in understanding what XML Web services are.

We use Visual Basic .NET and C# to develop the XML Web service examples throughout this book. We assume that the reader has a working knowledge of at least one of these languages. If you aren’t familiar with Visual Basic .NET or C#, we’d recommend that you spend time learning one of these languages before starting the examples in this book. We also assume the reader is familiar with the Microsoft .NET Framework and has some experience developing for that platform using Microsoft Visual Studio .NET.

Although we use ASP.NET in sections of this book, we do so only to provide the necessary framework in which to demonstrate the example XML Web services. We fully describe all ASP.NET code that we use and do not assume the reader has any pre-existing knowledge of the topic.

Finally, we expect the reader to have an appreciation of XML, but we do not assume a detailed knowledge of any of the standards on which XML Web services are based.

Organization of This Book

The book consists of three parts and a set of appendices. The book is structured to walk the reader through the process of XML Web service development. We take a focused approach, teaching readers only what they need at each stage without using an excessive level of ancillary detail, overly complex technical jargon, or unnecessary digressions into detailed discussion of specifications and standards.

Part 1—Understanding XML Web Services

Part I introduces the reader to XML Web services. We clearly define what XML Web services are and provide an overview of the technologies and standards that are used to implement them. We also guide readers through preparing the Visual Studio .NET development environment to allow them to develop XML Web services for the .NET Framework. This environment is used throughout the rest of the book.

Part 2—XML Web Services and Clients

Part II uses the example of a credit card validation system to take the reader through the steps necessary to develop, configure, and test an XML Web service for the Microsoft .NET Framework.

Having created his or her own XML Web service, the reader will be keen to use it, as well as to start making use of other publicly available XML Web services. We develop a variety of client applications for the credit card validation system, providing everything the reader needs to know to use XML Web services from within their applications.

Part 3—Advanced XML Web Services

In Part II we focused on the production and consumption of a simple XML Web service, skipping many issues that will be immediately apparent to an experienced programmer, including security, state management, and transaction support. These topics are not of interest to every XML Web services developer and are only applicable under certain circumstances. We discuss each of these advanced topics in Part III, providing context for the discussions by extending the example XML Web service and clients developed in Part II.

Part 4—Appendixes

In Appendix A, we provide additional listings and coverage of the sample code used in this book. For those readers who want to understand XML Web services at the most fundamental level, Appendix B provides extensive links to Internet resources that cover the specifications and standards for XML Web services. Although the field of XML Web services is awash with specifications and standards, given the tools available in Microsoft .NET, understanding these standards is not essential to developing XML Web services.

Installing and Using the Practice Files

In Part II and Part III of this book, we conduct a detailed exploration of XML Web service development, using sample programs to demonstrate the features and principles we discuss. We wanted to base our examples on an easily understood but realistic set of problems, so we chose to develop a credit card validation system implemented as an XML Web service.

The downside of using a realistic example is the necessity of developing business logic that would distract you from the main purpose of this book: to learn about XML Web services. For this reason, we encapsulated the business logic associated with credit card validation into a dynamic-link library (DLL) that is referenced by the XML Web services we develop.

The library is named CreditCardValidator.dll, and it can be downloaded from the book’s Web site along with the other sample code for this book by using the instructions provided in the following section. Chapter 3 contains an overview of the functionality contained in the library as well as instructions for how to use the library from a Visual Studio .NET XML Web service project. For those readers who want to know more about the CreditCardValidator.dll library, Appendix A, contains a complete description, including source code listings in both C# and Visual Basic .NET.

Important

You must have the CreditCardValidator.dll file to build the XML Web service examples contained in this book. The library should be either downloaded from the book’s Web site or created using the code and instructions contained in Appendix A.

Downloading and Installing the Libraries and Sample Code

The sample code and libraries used in the exercises in this book should be downloaded from the book’s Web site (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a09e4d5b-7d94-4c43-bbb5-d3321e7dfa6e). The C# sample code and the Visual Basic .NET sample code are separate downloads.

When the sample files are installed on your computer, two top-level folders will be created: Samples and Projects. Inside the Samples folder will be a folder named CreditCardValidator, which contains the source code and a compiled version of the CreditCardValidator.dll library. The Samples folder also contains a folder named ClientTemplate, which contains files for building the client application that we use in many examples. Inside the Projects directory, a folder for each chapter of the book will also be created. Each chapter folder contains a separate folder for every project that’s built within that chapter.

Procedure 1. To download the sample code, follow these steps.

  1. Establish a connection to the Internet.

  2. Using your browser, navigate to the Web site for this book; the address is http://www.microsoft.com/mspress/books/5955.asp.

  3. On the right side of the Web page, in the More Information area, click the Companion Content link.

  4. Click the Download Sample Code link for the programming language you are interested in using. The page includes a link for the C# sample code and another for the Visual Basic .NET sample code.

  5. The download link opens a Web Package executable file containing a license agreement. To copy the sample files onto your hard disk, click the link to run the executable and then accept the license agreement that is presented. By default, the sample files will be copied to the C:XMLWebServicesSBS folder. During the installation process, you’ll be given the option of changing that destination folder, although to minimize confusion with the instructions we provide in the book’s exercises, we suggest you use the default folder path.

    Important

    We’ve assumed that most readers will download either the Visual Basic .NET or the C# sample code, and the paths provided in the step by step procedures reflect this. If you download the sample code for both C# and Visual Basic .NET, you should specify a folder other than C:XMLWebServicesSBS for one language to avoid copying over sample files already on your computer.

    Note

    The sample code demonstrates the XML Web service principles we are discussing. For this reason, we have striven for clarity over performance. Although there may be more concise or efficient implementations of the sample code, it is not our intention to provide optimized solutions; we leave that to the reader to explore.

System Requirements

To run the sample XML Web services and client programs that we create throughout this book, you need a computer running Microsoft Windows 2000 or Microsoft Windows XP. You also need Microsoft Visual Studio .NET, which includes a complete installation of the Microsoft .NET Framework. You can find the complete requirements for running Visual Studio .NET at http://msdn.microsoft.com/vstudio/productinfo/sysreq.asp. Finally, you will need Internet Information Services (IIS) to provide access to your Web services. Both Windows 2000 and Windows XP operating systems include IIS version 5.0, which, if not present, can be installed from the operating system media.

Conventions and Features in This Book

Throughout the exercises in this book, we provide sample code for both C# and Visual Basic .NET. The code for each language is clearly identified by a heading. Text or other information that you need to enter to follow the steps is highlighted in boldface type.

You should also be sure to review several important sections of the book that include instructions that apply to examples throughout the book. We provide detailed instructions for creating a Web reference in the section "Creating a Web Reference," in Chapter 4. In Chapter 5, in a sidebar titled "Copying Web Projects," we provide step by step details for how to copy an XML Web service project for use in a later chapter. In Chapter 7, in a sidebar titled "XML Web Service Client Projects," we describe the steps to take to work with the client application template that’s used as a starting point in several chapters.

Support

Every effort has been made to ensure the accuracy of this book. Microsoft Press provides corrections for books through the World Wide Web at the following address:

http://www.microsoft.com/mspress/support

To connect directly to the Microsoft Press Knowledge Base and enter a query regarding a question or an issue that you might have, go to

http://www.microsoft.com/mspress/support/search.asp

If you have comments, questions, or ideas regarding this book, please send them to Microsoft Press via post mail to

Microsoft Press Attn: Microsoft .NET XML Web Services Step by Step Editor One Microsoft Way Redmond, WA 98052-6399

or via e-mail to

Note that product support is not offered through the above mail address. For product support information, visit the Microsoft Product Standard Support Web site at

http://support.microsoft.com/directory

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.4.181