Web Service Software Factory
The Web Service Software Factory (also known as the Service Factory) is an integrated collection of tools, patterns, source code and prescriptive guidance. It is designed to help you quickly and consistently construct Web services that adhere to well known architecture and design patterns.
If you are an architect or developer responsible for building service-based applications, the patterns & practices team would like to invite you to learn how the Service Factory can help your future service development activities. The Service Factory provides guidance that addresses many of the challenges associated with building ASP.NET (ASMX) and Windows Communication Foundation (WCF) Web services and the components of a distributed application. These challenges include:
- Designing ASMX and WCF messages and service interfaces.
- Applying exception shielding and exception handling.
- Designing business entities in the domain model.
- Translating messages to and from business entities.
- Designing, building, and invoking the data access layer.
- Validating the conformance of service implementation, configuration, and security using code analysis.
- Planning for the migration to WCF.
- Applying security to WCF services.
- Applying message validation.
Use the following information to determine whether Service Factory is right for you, your team, and the services you are building.
Generally speaking, software factories represent a collection of guidance that helps architects and developers build a specific kind of application. Therefore, the Service Factory helps developers and architects build Web service applications. Web service applications are more than just the technologies that send and receive SOAP messages and expose WSDL contracts—they also include the functionality that is needed to fulfill the service's behavior. Figure 1 illustrates the parts of the application, and their relationship with one another, the Service Factory will help you build.
Figure 1. Structure of a service built with the Service Factory
In addition to the challenges listed in the "Summary" section, the reality is that technologies are constantly evolving. Another challenge that should be addressed is how to build XML Web services using the .NET Framework 2.0 (ASP.NET and Web Services Enhancements (WSE)) so they can be migrated in the near future to the .NET Framework 3.0 (WCF, Windows Workflow (WF), and CardSpace™). The Service Factory helps build services on currently shipping technologies that have a path to future technologies. It does this by introducing concepts that are closely related to the next generation technologies and providing design guidance that minimizes the amount of future change. If you are already building services using WCF, the Service Factory also helps you build and secure those services.
Service Factory guidance is available in three basic forms:
- Written documentation. In addition to detailed How-to topics and the printable patterns enabled through the use of the Service Factory, there are several architecture-related topics that explore the finer details and rationale of the guidance. For example:
- Web Service Application Architecture
- Message Design in Service-Oriented Applications
- Exception Handling in Service-Oriented Applications
- Planning for and Migrating to WCF
- Guidance packages. Using the Guidance Automation Extensions with guidance packages, developers can have a "conversation" with Visual Studio 2005 through the use of wizards and shortcut menus. The conversation results in the generation of source code and configuration that adhere to proven practices. Two guidance packages are included in the Service Factory:
- ASMX guidance package. This guidance package helps build the service interface, the messages the service will expose and consume, and the translators that map these messages to domain model entities.
- Data Access guidance package. This guidance package helps build business entities from and existing data model, build stored procedures from a data model, and generate the repository classes and factories that comprise the data access logic.
- WCF guidance package. This guidance package helps build the service interface, the messages and data contracts the service will expose and consume, and the translators that map these messages to domain model entities.
- WCF Security guidance package. This guidance package helps secure WCF services using X.509, Kerberos, and direct authentication approaches by generating the necessary configuration sections.
- Reference implementation. Global Bank is a fictitious organization whose requirements are addressed by this solution. The solution was built using the preceding guidance packages and can be used as an example of how to apply additional functionality, such as logging and exception management, to a service. For more information, see Global Bank Scenario.
The Service Factory provides the following benefits:
- Increased quality. It provides tested and accepted reusable assets, guidance, and examples that address common scenarios and challenges. It is based on patterns derived from proven industry and Microsoft practices.
- Increased predictability. The patterns & practices team works closely with the development teams responsible for building current and future generations of service and data access technologies. All services built with the Service Factory will be built in a predictable way, arrive at a predictable result, and will enable a predictable migration path to future technologies.
- Increased productivity. It includes automated code and configuration file generation for Visual Studio 2005. With this automation, developers can easily apply guidance in consistent and repeatable ways. Developers can also effectively use the .NET Framework without having to devote significant time to learning the necessary APIs.
- Increased flexibility. The Service Factory is carefully designed according to proven practices, but it is also open and highly customizable. Architects and development leads can customize the factory to include the conventions, policies, and practices specific to a team or organization.
Based on the target audience, the Service Factory will provide various levels of value. This target audience can be defined by the role of the person using it, and the type of application being built:
- Architects. If you are an architect with a focus on service orientation, it is likely the Service Factory was designed with you in mind because of the responsibilities of your role.
- Developers on a team. If you are a developer on a team and your responsibilities do not span all of the layers in Figure 1, the guidance packages can be installed separately to help you build the part of the application you are responsible for. Development of these various layers can often occur simultaneously. Also, the Service Factory should help larger teams realize larger productivity gains.
- Single developer. If you are a developer who is responsible for building the entire service, the Service Factory includes detailed guidance about how and when to perform the activities necessary to construct each layer. During this process, you will also have the confidence that you are adhering to established patterns and proven practices.
- Service types. This release of the Service Factory helps with the following services:
- Entity services. These services provide access to data entities that provide a business-oriented view of the information managed and manipulated by an organization's processes while encapsulating the details of their persistence strategy. An example operation might be "GetCustomerDetails."
- Activity services. These services deliver repeatable encapsulated business value and may require the consumption of entity services to fulfill the request. An example operation might be "RetrieveCreditScore."
Future releases of the Service Factory will also help with the following services:
- Process services. These services manage long-running business processes. These services are controlled by an organization's workflows, and they often orchestrate the use of other services. An example operation might be "ProcessInsuranceClaim."
- Utility services. These services provide infrastructure functionality, such as logging, content routing, security, and publish/subscribe capabilities. These services may operate on the headers or body of the message, and they may have to comply with specifications, such as WS-Security.
The patterns & practices team expects individuals and organizations to standardize on the use of Service Factory for the development of their services. This will ensure consistency across services and provide predictability for future technology evolutions.
The best way to get familiar with the Service Factory is to view the webcast listed in the "Summary" section. This introduction tells you why the Service Factory was built and demonstrates the guidance automation experience in Visual Studio. Toward the end of the webcast, there is a demonstration that applies security to a WCF service using the next release of the Service Factory.
The best way to begin your evaluation of the Service Factory is to download the hands-on lab listed in the "Summary" section. This lab introduces you to many of the activities that will be performed during the construction of an ASP.NET service in C# for the fictitious Coho Winery:
- Exercise 1: Create solution structure
- Exercise 2: Create data types
- Exercise 3: Create message types
- Exercise 4: Create service operations
- Exercise 5: Create business entities
- Exercise 6: Translate between messages and business entities
- Exercise 7: Create CRUD stored procedures
- Exercise 8: Create data repository classes
- Exercise 9: Invoke data access layer
- Exercise 10: Wire up client and test service
The lab has been put together in such a way that the exercises can be completed in order, but you can also start at any point and perform the exercises in any order that is appropriate for your learning.
If there are specific areas you would like to know more about, you can use the "Exploring the Service Factory" topic in the documentation.
To view and run the Service Factory assets in your development environment, you need the following software installed on your computers:
- Microsoft Windows 2000, Windows XP Professional, Windows Server 2003, or Windows Vista operating system
- Microsoft .NET Framework 3.0
- Microsoft Visual Studio 2005 (with the exception of the Express edition)
- Microsoft SQL Server 2005 Express Edition or SQL Server 2005
- Guidance Automation Extensions Technology Preview (February 2007 Release for Visual Studio 2005)
In addition, you may want to install the following software:
- If you will be modifying the Web Service Software Factory guidance package, you must install the Guidance Automation Toolkit Technology Preview (February 2007 Release for Visual Studio 2005) in addition to the Guidance Automation Extensions.
- If you want to use the Enterprise Library Configuration Tool—for example, to modify the settings in the Data Access Application Block that is being used in the reference implementation—you will need to install Enterprise Library.
- To run the Visual Studio Team System (VSTS) unit tests, you must have Visual Studio Team System version 2005 installed. For more information about VSTS, see Microsoft Visual Studio Team System Developer Center on MSDN.
- To run the NUnit tests, you must have NUnit version 184.108.40.206 installed. You can download NUnit from the NUnit Web site.
The good news is that this is not the last version of the Web Service Software Factory. The next version of the Service Factory is expected to be released toward the end of the 2007 calendar year and will focus primarily on service modeling, additional automated guidance, and composing various parts of the application's architecture. Planning for these releases is in the very early stages, but the key areas of focus are likely to include the following:
- Service modeling
- Data access
Adding support for modeling Web services using a Domain Specific Language (DSL) is a major theme for the next release of Service Factory. The details of exactly how this will be implemented have not yet been finalized. For more information about the next version of Service Factory, keep monitoring the Service Factory Community site.
This release of the Service Factory includes guidance to help developers adhere to proven practices while building business-entity based data access layers with ADO.NET 2.0.
The next release of Visual Studio will include additional features designed to simplify the process of designing and implementing data-driven .NET Framework applications, in the form of .NET Language Integrated Query (LINQ). LINQ to ADO.NET will enable the LINQ programming model to work with the Microsoft managed code data access platform. As these new technologies become available, the recommended practices for building data-driven applications will be updated.
The initial releases of the Service Factory target ADO.NET 2.0, but the suggested patterns and approaches for building data access layers and entities are designed to simplify migration to the LINQ to ADO.NET technologies in the future. To demonstrate this migration, the patterns & practices team will release migration guidance and reference implementations that show how the Service Factory architecture applies these new technologies. The Service Factory will also be updated to fully support these technologies when they are officially released.
For information about known issues with the Service Factory, read the KnownIssues.htm file. To view this file, click Start on the taskbar, point to All Programs, point to Microsoft patterns & practices, point to Web Service Software Factory, and then click Known Issues.
To provide feedback about this guidance, or to get help with any problems, visit the Web Service Software Factory Community Web site. The message board on the community workspace is the preferred feedback and support channel because it allows you to share your ideas, questions, and solutions with the entire community.
Note It is very important you understand that all the releases on the community workspace are NOT final in any way. They have not yet undergone the complete array of performance and security tests, so patterns & practices team recommends that you treat downloads from the community as beta guidance.
The Service Factory was produced by the following individuals:
- Program and Product management: Don Smith, Dmitri Ossipov, Jason Hogg, Sanjeev Garg, and Tom Hollander (Microsoft Corporation)
- Architect: Dragos Manolescu, Wojtek Kozaczynski, and Edward Jezierski (Microsoft Corporation)
- Development: Chris Tavares (Microsoft Corporation); Hernan de Lahitte (Digit Factory); Pablo Galiano, Juan Wajnerman, José Escrich (Clarius Consulting); and Brian Button (Asynchrony Solutions, Inc.)
- Test: Larry Brader and Carlos Farre (Microsoft Corporation); Tushar More, Mani Krishnaswami, Manickavasagam Shanmugasundaram, Arunkumar Sundararajan, Sajjad Nasir Imran, Meenakshi Krishnamoorthi, Muralidharan C Narayanan, Manu Agarwal, Bhavin Raichura, Vinod Kumar S, Venkata Reddy Donthireddy, and Lalitha Sundaram (Infosys Technologies Ltd)
- Documentation: Nelly Delgado and RoAnn Corbisier (Microsoft Corporation); Lonnie Wall (RDA Corporation); William French (Linda Werner & Associates, Inc.); Paul Slater (Wadeware LLC); Tim Osborn (Ascentium Corporation); Tina Burden McGrayne (TinaTech, Inc.); and Claudette Siroky (CI Design Studio)
Many thanks to the Microsoft Practice team at CGI's Quebec City office who contributed to the development of the Service Factory and who were entrusted with its conversion to Visual Basic .NET. A leading IT and business process services provider with approximately 25,000 professionals operating in more than 100 offices worldwide, CGI works on behalf of its clients to evolve Service Factory and other patterns & practices offerings. To learn more about CGI's Microsoft solutions, visit the CGI corporate Web site.
Many thanks to the following advisors who provided invaluable assistance:
- Edward Bakker and René Schrieken (LogicaCMG); Aaron Skonnard (Pluralsight); Gabriel Gilabert and Patrick Johnston (Thomson Financial); Norman Headlam (Fidelity Investments); Brandon Bohling (Intel Corporation); Alejandro G. Jack (Southworks); Christian Weyer (Thinktecture); Daniel Cazzulino (Clarius Consulting); Steve Millet, Jan Alexander, Andy Gordon, Mark Fussell, Ford McKinstry, Steve Maine, Eugene Osovetsky, Daniel Roth, Jezz Santos, Beat Schwegler, Shy Cohen, Serena Yeoh, Vajira Weerasekera, Sam Keall, Jason McConnell, Pablo Castro, Sanjay Mishra, and Umachandar Jayachandran (Microsoft Corporation)