《build+message-based+web+services+for+service+oriented+architecture》由会员分享,可在线阅读,更多相关《build+message-based+web+services+for+service+oriented+architecture(44页珍藏版)》请在金锄头文库上搜索。
1、Build Message-Based Web Services for Service Oriented Architecture,Jeffrey Hasan, MCSD President Bluestone Partners, Inc.,Talk Agenda,Overview of SOA Build a Message-Oriented Web Service Build a Service-Oriented Web Service WSDL Overview Introducing the Web Services Enhancements 2.0 (WSE),About Me,J
2、effrey Hasan President, Bluestone Partners Inc. A technology services company based in Orange County. We build business applications using .NET; our speciality is Service Oriented Architecture. (Co-) Author of: Performance Tuning and Optimizing ASP.NET Applications, APress, 2003. ISBN: 1590590724.
3、ADO.NET Programmers Reference, Wrox Press, 2001. Professional .NET Framework, Wrox Press, 2001. Professional VB6 Web Programming, Wrox Press, 1999. Articles for MSDN Magazine and Advisor Media publications.,New SOA Book,Expert Service Oriented Architecture in C# Using the Web Services Enhancements 2
4、.0 Published by: APress (August 2004) http:/ is a Service?,A service is a distributed component that provides a well-defined interface for processing and delivering XML messages A service is the basic building block of a loosely-coupled, distributed application.,SOA Example,SOA in Concept,Services I
5、n Depth,Services are autonomous components that process well-defined XML. Services provide a well-defined interface that is described by an XML-based document called the Web Services Definition Language (WSDL) document. Services provide endpoints that consumers and other services can bind to, based
6、on the services port address (typically a URL) Services are analogous to traditional object-oriented (OO), type-based components,Services Versus OO-Components,Services are described by a WSDL contract, not by type libraries Documents metadata; ports; bindings Service descriptions can be easily exten
7、ded Services provide flexible binding WSDL document provides metadata descriptions; clients can dynamically bind Services provide a service guarantee Policy files document service agreements and expectations Services allow for things to go wrong Addressing; Reliable Messaging XML messages preserve t
8、he integrity of requests; and provide a record of communication,SOA in Practice,SOA Architecture - Basic,Service Interface - Support,Communication requirements that the service specifies in its WSDL contract (specifically, in its binding information). This includes the format and transport protocols
9、 that the service responds to (e.g., SOAP over HTTP). Security requirements that the service specifies. In .NET terms, the .asmx code-behind can implement code that verifies incoming XML messages to ensure that they contain the required security tokens or headers. Methods (operations) that the servi
10、ce specifies in its WSDL contract. In .NET terms, the .asmx file provides methods that correspond to the service operations, but the actual business processing should be handed off to dedicated components and workflow.,SOA Architecture - Advanced,WS Communication,Why Use Services?,A service-based ap
11、proach makes sense for building solutions that cross organizational, departmental and corporate domain boundaries. A business with multiple systems and applications on different platforms can use SOA to build a loosely-coupled integration solution that implements unified workflows.,How to Build Mess
12、age-Oriented Web Services,XML Messages I,XML Messages II, MSFT Microsoft Corporation 11/17/2003 16:00:00 26.12 24.68 25.49 25.15 -0.36 -0.0137 25.49 35 22 ,StockTrader Operations,StockTrader Web Service Types,Step #1: Design Schema,Step 1: Design the messages and the data types Conceptually design w
13、hat the messages and data types will look like. UML class diagrams are the best way to capture this information.,Step #2: Build XSD Schema,Step 2: Build the XSD schema file for the data types Use an XML designer tool to build the XSD schema file for all of the data types that are exchanged by the We
14、b service methods. Visual Studio .NETs XML Designer is a good tool, but you can use any XML Designer tool that you are comfortable working with.,Step #3: Create Class Interface,Step 3: Create a class file of interface definitions for the messages and data types. The interface definition class file p
15、rovides the abstract definitions of the Web service methods and its data types. This class file derives from the System.Web.Services.WebService class, so it can be readily implemented in a Web services code-behind file. The .NET Framework provides a command-line tool called xsd.exe for generating an
16、 interface definition class file based on an XSD schema file. This will manually generate class definitions for the data types. You can add this class file to your Web service project and then manually insert abstract definitions for the Web methods.,Step #4: Implement Interface,Step 4: Implement the interface in the Web service code-behind file Implement code for the Web methods. The Web service .asmx code-behind class derives fro