(Paperback - BK&CD-ROM)
XML Programming is the best place to find detailed instructions and insights on how to take advantage of XML and the Microsoft Visual Studio development environment to create extensible, end-to-end applications. Taking an architectural approach, the authors of the book carefully describe the XML hooks to be found in the next generation of Visual Studio and the .NET platform, plus how XML works with other Microsoft products such as Microsoft SQL Server 2000 and Microsoft BizTalk Server 2000.
More Reviews and RecommendationsSultan Rehman, based in Hong Kong, is the Chief Software Architect for Engage Asia/Australia where he is responsible for designing and implementing next generation ad serving and optimization solutions. He specializes in using object oriented designs for implementing mission critical, distributed systems. One of his current projects involves developing a high-performance and extensible XML Server that exposes a legacy database schema through a set of DTD constrained XML documents, XLST templates, and XML-RPC methods.
R. Allen Wyke is a Director of Product Technology at the Internet marketing solutions company, Engage. He is constantly working with XML and various other Internet technologies in implementing online marketing software and services.
Brad Leupen is the Chief Technology Officer for the education software company Entrinsik Inc., where Brad has brought web-based products to market that utilize cutting-edge technology such as XML and XSLT.
Learn how to use XML and the Microsoft® .NET Framework to build extensible, end-to-end applications that work seamlessly across the Internet.
XML Web services will play a central role in the next era of computing by initiating a new cycle of opportunities for developers and customers. Get detailed instructions and insights on how to take advantage of XML and Microsoft® development tools in this comprehensive reference. Taking an architectural approach, it describes the XML functionality in Microsoft Visual Studio® .NET, Microsoft SQL Server 2000, and Microsoft BizTalk Server 2000. It also demonstrates step-by-step how to convert a traditional client/server application to an XML-based application. This book is the ideal resource for anyone who wants to make maximum use of Visual Studio. NET, other XML-enabled Microsoft development tools, and the Microsoft .NET Framework to create extensible, end-to-end applications that work across multiple devices and platforms. Topics in this expert guide include:
In this chapter we will design and implement the database logic, the data sets, and data adapters that provide access to the underlying datastore, the business logic that comprises the "guts" of the application, and, finally, a variety of Web Services that expose our business logic to clients.
A production application of the the Golf Reservation System variety would normally provide much more functionality, but for the purposes of this book, the project allows us an under-the-hood view of .NET in action. It ties together course and user data, makes that data available through XML Web services, and displays it using the controller design pattern discussed in previous chapters.
The XML Web services logic of the Golf Reservation System will not query the Access database directly. Instead, all data access will flow through a more abstract CourseDataSet class. The CourseDataSet will mimic the structure of the underlying DBMS and will provide quick and easy access to data from the application layer.
Using a DataSet to mask the underlying database has a number of advantages. First and foremost, it breaks the traditional ties that bind business logic to specific DBMS's. The Golf Reservation System's server-side component could be rewritten with a minimum amount of effort to support new database requirements. Second, direct in-memory DataSet access eliminates expensive boundary crossings to call into the database. Data can be retrieved quickly from the DataSet without the need for repetitive SQL queries. Finally reducing the load on the database engine frees it to operate more efficiently, enhancing the scalability of the application.
"Finder" XML Web services used for searching will create DataView objects to query the data contained in the CourseDataSet. Web Services can filter data by means of the DataView class's RowFilter property. Row filters use Expression objects to provide rich, SQL-like selection capability.
The server will implement a series of DataAdapter classes to handle all marshaling of data to and from the database. There will be a single DataAdapter class for each database table. These adapters will work together to load the table data into a consolidated data set. Data updates will require the following three separate steps:
Not every class in the application mirrors a database table as does the GolfCourse class. The same will likely hold true with any application you build inside the .NET Framework. For example, the fact that the application contains an address class as an address object can be useful because, at least within our application, it relates to and holds requirements for the same properties and methods across multiple business entities (both a golfer and a golf course have addresses). Obviously, one goal of a .NET application is code reuse, and although this is a simple example, it's a good example nonetheless.
Table 9-1 contains the business objects in the Golf Reservation System application.
GolfCourseService, like all XML Web services, is responsible for masking business object design complexities and particulars. The developer that needs to call into and retrieve data from Web methods need not know whether a table of addresses is in the database. The application calls into the GolfCourseService XML Web service via SOAP requests and receives SOAP responses. The .NET Framework, though, handles the complexities of creating, sending, receiving, and parsing the SOAP documents.
Browsing to an XML Web service with a Web browser results in a detailed description of the XML Web service, what methods it provides, and how to call into those methods using the supported protocols. Figure 9-1 shows the GolfCourseService called in this manner.
Figure 9-1 Browsing to an XML Web service provides detailed information about the methods provided.
Clicking a specific method (see Figure 9-2) offers a detailed description of that method and a form to invoke it, given your inputs. Note that submitting the form invokes the method and will perform the actions of that method as if it were called from an application If the method results in a new database insert, submitting this form will do the same. Also detailed on the method description page is the protocol syntax request and response for SOAP calls, HTTP POST, and HTTP GET.
Figure 9-2 Clicking a Web method offers a method description and protocol syntax for invoking the method.
As detailed in Figure 9-1 , the GolfCourseService offers the following Web methods, listed here by method signature:
public GolfCourse[] FindAll() public GolfCourse[] FindGeneric(String[] fields, String[] values) public GolfCourse GetCourseDetail(String id) public GolfCourse AddCourse(String name, String description, String price, String streetAddress, String city, String state, String postalCode, String country, String telephone) public GolfCourse AddTee(int courseId, String description, float slope) public GolfCourse AddHole(int teeId, int handicap, int length, int hole, int par) public TeeTime AddTeeTime(int courseId, int golfer, DateTime date, DateTime time) public TeeTime[] FindTeeTimesByGolfer(int golferId) public Golfer AddGolfer(String firstName, String lastName, String street Address, String city, String state, String postalCode, String country, String email, String phone, String username, String password) public Golfer FindGolferById(int golferId) public Golfer ValidateLogin(String username, String password) public TeeTime[] FindTeeTimesByDate(int courseId, DateTime date) public TeeTime[] FindTeeTimesByDateRange(int courseId, DateTime startDate, DateTime endDate)
These Web methods and the classes behind them make up the server-side component of our application and represent the proxy necessary for other applications to interact with and manipulate the Golf Reservation System business logic. We will break down these Web methods and the Golf Reservation System server business logic behind them in more detail later in the chapter.
Imagine the Golf Reservation System server application as a stand-alone service provided by a conglomeration of golf courses. Multiple Internet applications could call into those services and format and manipulate data as they saw fit: one client application might use the GolfCourseService only to retrieve data, while another might retrieve golfer information from the GolfCourseService, caring nothing about the course data also available.
Although the application is tailored to a specific client—one that allows validated users to register for tee times—the Web methods could be designed modeling only the data behind them. This approach would provide an XML Web service interface for retrieving the data published on the Internet that was not tailored to a specific client application design, but instead provided abstractions on a complex data store.
INSERT INTO course(city, country, description, name, postalCode, price, state, streetAddress, telephone) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
Table 9-2 contains the fields inside the course table....
loading...
loading...
loading...
Terms of Use, Copyright, and Privacy Policy
© 1997-2009 Barnesandnoble.com llc
