Developer .NET UPDATE—brought to you by Windows & .NET Magazine Network.
THIS ISSUE SPONSORED BY
Microsoft ASP.NET Connections
Windows & .NET Magazine LIVE!
(below DEVELOPER .NET PERSPECTIVES)
SPONSOR: MICROSOFT ASP.NET CONNECTIONS
MORE SESSIONS, TOP QUALITY, UNBEATABLE VALUE
DevConnections Conferences provide more sessions at a lower cost than other events focused on Microsoft technologies.
Register today for either Microsoft ASP.NET Connections, VS.NET Connections, or SQL Server Magazine LIVE! and you'll get access to over 160 sessions and save $2,790.
This deal gets even better: Stay for the week and save $4,785 when you also register for either XML Web Services Connections or Windows & .NET Magazine LIVE!. Register for the entire week and you'll get access to five conferences and 240 sessions. Hurry before this offer expires:
October 8, 20022—In this issue:
1. DEVELOPER .NET PERSPECTIVES
- Creating a Distributed Class Library: Defining the Class Hierarchy
- Announcing the New Windows & .NET Magazine VIP Site!
- New! News, Tips, and More to Keep Your Network Humming
3. NEW AND IMPROVED
- Track Your Applications' Defects and Features
4. CONTACT US
- See this section for a list of ways to contact us.
1. DEVELOPER .NET PERSPECTIVES
(contributed by Bill Sheldon, [email protected])
The goal of designing a robust set of business objects is to let developers use the UI that's most appropriate for their applications. Last week, I discussed how you can use the Microsoft .NET Framework to create a Win Form application for Internet users. This week, I show you how to use XML Web services in the business-logic tier to Internet-enable an application, such as an existing Windows 32-bit GUI client. The true power of the business-logic tier is that you can construct classes that are equally usable by browser-based Web Forms and Win Forms.
Since my August 20 column "Speaking as an Engineer and an Author," I've used a sample class library that includes person and employee classes. Building on that sample class library, suppose that you want to create an abstract person object that will act as the core for various specialized people (e.g., employees, authors) that your application will reference. The usual default class hierarchy in this situation is to use the person class as the base or parent class, then have an employee class as the child. However, you want to split the functionality between physical machines; as a result, you need to vary from this default design.
To split the functionality, you need to create a parent-child relationship within the employee class. By creating two related classes, you can have one class on the server and one class on the client. However, note that you're not creating two separate classes but rather using inheritance to make all the functions in the first class available to its child.
Suppose that the two classes are EmployeeClient (i.e., the client version of the employee class) and EmployeeServer (i.e., the server version of the employee class). Logically, you can implement the parent-child relationship as either EmployeeClient-EmployeeServer or EmployeeServer-EmployeeClient. Which class should be the parent in this situation? Initially, you might think that EmployeeServer class should inherit all the functions available in the EmployeeClient class because you want to have the EmployeeClient class fully reusable in the server-based browser application. However, having an EmployeeClient-EmployeeServer relationship would place the functions required by the client in the server-based class. To access these functions, the client would need to instantiate a copy of the EmployeeServer class in the UI logic. Because you would need to locally instantiate the EmployeeServer class, you wouldn't gain any value from having the EmployeeClient class. Thus, making the EmployeeServer class the parent of EmployeeClient class (i.e., a EmployeeServer-EmployeeClient relationship) makes more sense.
How can the .NET Framework create an instance of the child class (EmployeeClient) without having a copy of the parent class (EmployeeServer) on the client? By defining those members of the EmployeeServer class that are to be public as "Web methods," the client can access the object without requiring a copy of the object. The .NET Framework provides the necessary tools that let Windows applications and classes access your remote class. To achieve remote access, you need to have the class inherit from the Web services class structure.
When you define a class as a Web service, the class inherits from the System.Web.Services.WebService class. To use Web services, you must inherit from this system class because the .NET Framework doesn't support multiple inheritance. Although in theory you can inherit from the person class and implement an interface to support Web services, in reality the code associated with creating a Web service implementation is much more challenging than defining a limited application-specific person-class interface. (An interface bridges the physical separation between a client and server by implementing the server methods as Web services.)
Although the EmployeeClient class inherits Web methods from the EmployeeServer class, you need to create the classes in two separate projects. The first project contains the EmployeeServer Web service, which contains the EmployeeServer class. The EmployeeServer project references the interface for the abstract person class.
Create the EmployeeClient class in a separate project and add a Web reference that links the EmployeeClient class to the EmployeeServer Web service. Web references use the Web Services Description Language (WSDL) to expose the Web methods.
From this point on, any code that references the EmployeeClient class triggers the system to instantiate a local EmployeeClient object. Those methods that EmployeeClient inherits from EmployeeServer appear as methods on this object. You don't need to create a proxy; the Web reference manages the information necessary to support the inheritance and calls the Web service implementation.
Before you expose and use any Web service, however, you need to secure your configuration. I'll discuss that topic in next week's column.
SPONSOR: WINDOWS & .NET MAGAZINE LIVE!
WINDOWS & .NET MAGAZINE LIVE! TO CO-LOCATE WITH XML WEB SERVICES CONNECTIONS
Real-World Tips and Solutions Here for You
Register now for Windows & .NET Magazine LIVE! and attend concurrently run XML Web Services Connections sessions for FREE. This conference is chock full of "been there, done that" information from people who use these technologies in the real world.
Immediately increase your productivity with shortcuts, tips, and tricks you'll learn. Solve those tough interoperability issues, enhance systems administration with new tools, learn how .NET will impact your job, and find out how to make Web services payoff for you and your career. Benefit from our mix of speakers representing magazine authors, Microsoft architects, and third-party gurus. This must-attend event is loaded with practical information you can use right away to help keep your skills sharp.
Find out how to save over $4,500 by extending your stay to include Microsoft ASP.NET Connections, VS.NET Connections, and SQL Server Magazine LIVE!. Hurry before this offer expires, go to:
(brought to you by Windows & .NET Magazine and its partners)
The Windows & .NET Magazine VIP Site is a new subscription-based online technical resource. For a limited time, you can access this banner-free site where you'll find exclusive content normally reserved for VIP Site members only. Only subscribers will be able to enjoy this new site after October 14, so check it out today!
Networking UPDATE brings you the how-to tips and news you need to implement and maintain a rock-solid networking infrastructure. We'll explore interoperability solutions, hardware (including servers, routers, and switches), network architecture, network management, network security, installation technology, network training, and WAN disaster recovery. Subscribe (at no cost!) at
3. NEW AND IMPROVED
(contributed by Sue Cooper, [email protected])
MCPCentral released OnTime 1.1, a multiuser application for small development and test teams (1 to 100 members) to keep track of any number of projects, subprojects, defects, and features. You can customize the interface for each user; filter defect and feature lists based on status, priority, or assignment; search on any field; and print reports. OnTime is built with the Microsoft .NET Framework using C#. It uses Microsoft SQL Server 2000 or Microsoft SQL Server Desktop Engine (MSDE) 2000 for data storage. The 10-user version of OnTime is free and full featured. The 25-user version is currently priced at $395. Contact MCPCentral at [email protected]
4. CONTACT US
Here's how to reach us with your comments and questions:
- ABOUT DEVELOPER .NET PERSPECTIVES — [email protected]
- ABOUT THE NEWSLETTER IN GENERAL — [email protected]
(please mention the newsletter name in the subject line)
- TECHNICAL QUESTIONS — http://www.winnetmag.net/forums
- PRODUCT NEWS — [email protected]
- QUESTIONS ABOUT YOUR DEVELOPER .NET UPDATE SUBSCRIPTION?
Customer Support — [email protected]
- WANT TO SPONSOR DEVELOPER .NET UPDATE?
This weekly email newsletter is brought to you by Windows & .NET Magazine, the leading publication for Windows professionals who want to learn more and perform better. Subscribe today.
Receive the latest information about the Windows and .NET topics of your choice. Subscribe to our other FREE email newsletters.