IBM Certified SOA Solution Designer Certification Prep .

Transcription

IBM Certified SOA Solution Designer certificationprep, Part 1: SOA best practicesSkill Level: IntermediateMark Lorenz (mlorenz@nc.rr.com)Senior Application ArchitectHatteras Software, Inc.10 Oct 2006Service-Oriented Architecture (SOA) is the next step in software development,leveraging XML technologies and Web services (WS) that went before. This bestpractices tutorial teaches you how to use SOA techniques in system designeffectively. Use this tutorial, along with the other educational resources, to helpprepare for IBM Certified SOA Solution Designer certification.Section 1. Before you startAbout this seriesThis tutorial will help you prepare for IBM certification Test 665: Architectural Designof SOA Solutions to attain IBM Certified SOA Solution Designer certification. Thisintermediate-level certification is intended for consultants and architects withexperience designing enterprise application components, enterprise businessintegration solutions, and those who are part of an SOA project team responsible forarchitecting the end-to-end design of an SOA solution. SOA is the next step insoftware development, leveraging XML technologies and Web services (WS) thatwent before. This tutorial teaches the reader how to use SOA techniques in systemdesign effectively.About this tutorialThis tutorial takes you through key aspects of using SOA technologies for yoursoftware projects. We will cover best practices (what designs to use in whichsituations.) It's written for software architects and business analysts who have aSOA best practices Copyright IBM Corporation 1994, 2008. All rights reserved.Page 1 of 21

developerWorks ibm.com/developerWorksbasic understanding of XML and Web services and who have advanced skills andexperience. You should have a general familiarity with business analysis andsoftware development methodologies.This tutorial is also intended for developers who have a background in XMLtechnologies and Web services. You should also be familiar with Internet standardsand concepts such as Web browser, client-server, documenting, formatting,e-commerce, and Web applications. Experience designing and implementing .NETor J2EE-based computer applications, and working with relational databases is alsorecommended.ObjectivesAfter completing this tutorial, you will know how to recognize SOA best practices andtheir benefits.PrerequisitesExperience in SOA, Web services, and XML.System requirementsYou need a system with an up-to-date browser.You need JavaScript enabled in your browser.Section 2. SOA Best PracticesA lot of hype surrounds SOA. And where there is hype, there is obfuscation. We willuse buzzwords, but we will ground them with clear explanations and correlations sowe can understand both their intent and meaning.Not long ago, the world of software development began to see products supportingmodel-driven development (MDD). SOA is arguably taking this direction further withwhat is called business-driven development (BDD), (see the Resources section forMitra). See Figure 1.Figure 1. Business-driven developmentSOA best practicesPage 2 of 21 Copyright IBM Corporation 1994, 2008. All rights reserved.

ibm.com/developerWorksdeveloperWorks MDD moved the initial focus to software modeling and to the role of the softwarearchitect. BDD takes the initiative up another level to business modeling and thebusiness analyst (BA) role.Because SOA is still relatively new in the world of software development, bestpractices are still emerging and evolving. Therefore, for now, we sometimes refer tothem as "guidelines".Before we delve into the details of SOA best practices, we need to make sure wehave some common language and definitions. So, lets take a brief look at XML, Webservices, and SOA.XML and Web servicesAs a brief refresher, XML is a lingua franca of the first level. It is an extensible taglanguage, understood across platforms and languages. It is used in many Webservices standards. The contents of the tags are validated, or parsed, by a schemathat defines the grammar.XML TutorialFor more on XML, take the XML technologies tutorials ondeveloperWorks.Web services are functionality building blocks that can be reused. They must bepublished, found (discovered), and invoked by provider systems using standardprotocols and semantics. This happens using XML with different grammars andrelated structures such as the following:SOA best practices Copyright IBM Corporation 1994, 2008. All rights reserved.Page 3 of 21

developerWorks ibm.com/developerWorks WSDL UDDI SOAPFigure 2 shows the relationship between these standards.Figure 2. Use of Web service standardsSince Web services are standards-based, they provide a lingua franca of a second,higher level.WSDLWeb services description language (WSDL) is an XML instance document thatcomplies with a W3C standard XML grammar for communication between servicerequesters and service providers. It describes how a Web service works. It isbecause of WSDL files that Web services are called "self-describing" becauseSOAP messages can be generated from WSDL files. In fact, many tools will createclient code from a WSDL file.A WSDL file contains the following elements: Type: Data-type definitions (string, int) using some grammar (such as anXML Schema) Message: The data being communicated Part: A message parameter Operation: Abstract description of an action supported by the service Port Type / Interface: An abstract set of operations supported by one ormore endpoints. This name has changed, so you may see either oneSOA best practicesPage 4 of 21 Copyright IBM Corporation 1994, 2008. All rights reserved.

ibm.com/developerWorksdeveloperWorks Binding: A concrete protocol and data format specification for a particularport type Port / Endpoint: A combination of a binding and a network address. Thishas also changed names, so you may see either one. Service: A collection of related endpoints, with their associatedinterfaces, operations, messages, etcFigure 3 shows the WSDL structure as presented by Thomas Erl (see Resourcessection for more information).Figure 3. WSDL structureAgain, remember that all the details needed to interact with a service are in itsWSDL file.Universal Description, Discovery, and Integration (UDDI)UDDI defines how to find a Web service (and its WSDL file). UDDI hasn't gotten asmuch use as WSDL and SOAP because many times a consumer knows the locationof Web services, which are often on the company intranet.UDDI listings are kept in a UDDI registry. Each listing can include the following: White pages: Address, contact, and known identifiersSOA best practices Copyright IBM Corporation 1994, 2008. All rights reserved.Page 5 of 21

developerWorks ibm.com/developerWorks Yellow pages: Industry categorizations based on standard taxonomies Green pages: Technical information about services exposed by thebusinessGreen pages are all that's required. They give access to the WSDL information forthe service.Simple Object Access Protocol (SOAP)SOAP is a protocol for exchanging XML-based messages across a network.Typically, HTTP is used as the transfer protocol, but other protocols such as SMTPcan be used.A SOAP message contains the following elements: Envelope: Is required and identifies the document as a SOAP message Header: Contains application-specific information Body: Is required and defines call and response information Fault: Contains information about errors that occurredAs we said before, the SOAP content may be determined by the WSDL file.SOAThe primary goal of SOA is to create and maintain closer synergies betweenbusiness and IT -- to make it easier to get functionality in a timely manner and in acooperative fashion with the IT organization. SOA is about wiring the Web servicebuilding blocks together according to business processes so that functionality isprovided from start to finish. SOA is a framework of the highest level -corporate-wide and beyond.You might wonder, "Why SOA"? Briefly, because it provides more flexibility andspeed when building systems. The most widely cited benefit of SOA is to "removebusiness analysts from the shackles of the IT department." But another reason forinterest in SOA was shown by Mansurov, as we see in Figure 4 (see Resourcessection for more information).Figure 4. Improvements in time to marketSOA best practicesPage 6 of 21 Copyright IBM Corporation 1994, 2008. All rights reserved.

ibm.com/developerWorksdeveloperWorks Since SOA moves more focus and time to earlier phases of development, this studyshowed that a 30% to 50% savings could be gained. That same study showed that36% of defects were due to mistakes at requirements time. This bodes well for thefuture of SOA.Now let's get to the real substance of this tutorial. We'll discuss categories ofguidelines, starting with general SOA guidelines.General SOA guidelinesFollow standardsYou'll see "WS-*" to indicate a whole set of Web services standards. These andother SOA-related standards are an infrastructure necessity. If you vary from thestandard, anyone trying to reuse your services will fail and won't come back. Allstandards are important, but let's go over a few of the major ones for SOA: WS-I: The protocol you use should be compliant with the Web ServicesInteroperability (WS-I) standard. HTTP, SOAP, and JMS are examples ofa compliant messaging infrastructure. WS-BPEL: Your business processes should be defined via businessprocess execution language for Web services (WS-BPEL). It's a longname, but this standard is necessary to document your process in across-product fashion. WSDL: As we said above, WSDL defines how a Web service works. UDDI: When used, UDDI registers a Web service so consumers can findit. SOAP: SOAP is a protocol for XML-based messaging over a network asdefined by its WSDL file. WS-*: There are many more that we will not discuss here, includingWS-Coordination, WS-Notification, WS-Policy, WS-Reliability,WS-Resource, WS-Security, WS-Transaction, and others.In order to truly have an SOA, you must follow at least these standards.SOA best practices Copyright IBM Corporation 1994, 2008. All rights reserved.Page 7 of 21

developerWorks ibm.com/developerWorksEnterprise Service Bus (ESB)An Enterprise Service Bus (ESB) is, as the name implies, anenterprise-wide communication mechanism that integrates anorganization's systems. It supports event-driven messagingbetween requestors and providers across a network while providingservices such as authentication and transaction management. Theservices can be in the .NET framework or on the J2EE platform; theprotocol can be HTTP or JMS; the platform can be UNIX orWindows.Follow SOA principlesIt is worth discussing some of the key principles SOA is based on: Loose coupling: Services must remain aware of each other, but changesin location, version, and implementation should be transparent.Frameworks such as Spring are loosely coupled, basing wiring ondeclarative configuration files and aspect-oriented weaving, but SOAtakes loose coupling to another level. In SOA, facilities such as the ESBadapt to change without involving client logic. And tools such as theWebSphere Integration Developer make wiring easy. Contractual interfaces: WSDL is the standard way to define a Webservice's interface and should be used to describe all Web services. Reusable services: There are multiple characteristics of reusability,including abstraction and coupling. A service should be defined at thesmallest size possible that will still provide support for a completebusiness function. If you add more functionality, the service becomes lessreusable since it doesn't work well with as many other services. Think interms of defining atomic services. Self-describing services: To be reused, a component has to be able tobe found. Stick to terms your business analysts can understand. Providerich descriptions. Use WSDL files that fully describe your Web services. Statelessness: Services should not maintain state between invocations.They should be designed to be reentrant so that no problem withconcurrent requesters occurs. Artus discusses issues related to whyservices need to be stateless (see Resources section for Artus). Thebottom line? Stateful services are less reusable.Service modeling guidelinesUse business names for servicesThe consumers of services are business analysts. As such, the names of servicesshould use their terminology and should have meaning to them. So, for example,you should have services such as Transfer Funds between Accounts insteadof ProcessTransferTransaction.SOA best practicesPage 8 of 21 Copyright IBM Corporation 1994, 2008. All rights reserved.

ibm.com/developerWorksdeveloperWorks Many of the modeling techniques from object-oriented systems development can beused in this area. For example, modeling sessions with domain experts, adaptedCRC cards, activity swimlanes, state transition diagrams, and other techniques areall useful on an SOA project to discover business services. In fact, Artus gives anexample of how to use state transitions to discover business services (seeResources section for Artus).Establish standard naming conventions within your organization. Check out somepublic UDDI registries to see how other companies are naming their services: BindingPoint XMethodsIn general, the service operations should be verb phrases and the service itselfshould be a noun. This advice comes from years of object-oriented systemdevelopment experience.Identify services wiselyNot everything should be a service. When identifying services, be sure to do thefollowing: Mine existing systems for candidate services. Focus on business value. Balance course- and fine-grained size.Ali Arsanjani states that "using goal-service modeling, you use a cross-sectionalapproach to cut down the sheer number of candidate services that might already beidentified. A more judicious approach would be to first do top-down, thengoal-service modeling, and finally bottom-up legacy analysis of existing assets" (seethe Resources section for Arsanjani). He defines goal-service modeling as basicallythe use of a business' goals to identify services needed to satisfy those goals.Watch for granularity and value-add. For example, if you are making a legacysystem available through a set of services, it may be better to keep larger "chunks"of the functionality together if they are tightly coupled. Focus on completefunctionality that works independently of other services.Fine-grained services tend to be more reusable but at a price in orchestration effort.More services means more work for a consumer to wire a business process. On theother hand, course-grained services are at risk of being less reusable whileproviding a larger set of functionality (and thus less orchestration effort). So what'san architect to do? The answer is an unsatisfying, "use your judgment oncase-by-case basis." However, following are some rules of thumb: Subdivide even further when you see portions of a service candidate thatcan provide stand-alone value to consumers. Keeping these portionsSOA best practices Copyright IBM Corporation 1994, 2008. All rights reserved.Page 9 of 21

developerWorks ibm.com/developerWorkstogether makes the overall service less reusable since not all consumerswill want all the functionality provided. Stop moving in a more granular direction when you reach a point of highcoupling (sometimes called "cohesion") where further subdivision willseparate highly coupled functionality. Further subdivision will not deliver acomplete solution for consumers.Finally, keep in mind that increased granularity means more messaging -- potentiallyacross a network -- which, of course, has performance implications.ChoreographDespite the name, this has nothing to do with dancing. Webservices are choreographed into composite applications by wiringtheir interfaces together to support a business process. The processhas business rules as part of its definition. Orchestration is similar tochoreography, but choreography spans multiple interested parties,while orchestration focuses on one participant.Follow a service-oriented methodologySOA is relatively new but there are already some proposed methodologies. Theseare often combinations and extensions of other existing methodologies. That's fine -it's important to have a process and techniques to follow. We'll now take you throughsome proposed methodologies for SOA. Methodology for Service Architectures: (Jones, 2005) focuses onservice discovery and provides a notation for the methodology. Thismethodology is focused on the earliest activities of SOA development.Figure 5 shows one of the techniques used in this methodology. Thismethodology can be a supplemental method, but doesn't have an entireset of steps for a whole SOA project.Figure 5. Primary tasksSOA best practicesPage 10 of 21 Copyright IBM Corporation 1994, 2008. All rights reserved.

ibm.com/developerWorksdeveloperWorks Service-Oriented Modeling Architecture (SOMA): According to AliArsanjani (see Resources section for link to Arsanjani), "Service-orientedmodeling approach provides modeling, analysis, design techniques, andactivities to define the foundations of a SOA. It helps by defining theelements in each of the SOA layers and making critical architecturaldecisions at each level. It does so using a combination of a top-down,business-driven manner of service identification coupled with a stream ofwork that conducts service identification through leveraging legacy assetsand systems." Service-oriented analysis and design (SOAD): Zimmermann makesthe case for SOAD by stating that: "While the SOA approach reinforceswell-established, general software architecture principles such asinformation hiding, modularization, and separation of concerns, it alsoadds additional themes such as service choreography, servicerepositories, and the service bus middleware pattern, which requireexplicit attention during modeling" (see Resources section forZimmerman). This methodology includes portions of business processmodeling (BPM) and object-oriented analysis and design (OOAD),expanding upon them to identify services and to synchronize BPM andOOAD artifacts. The methodology addresses the divide betweenWS-BPEL and WSDL, and addresses other topics, such as providing forquality of service (QoS). Being a long-term OO modeler, I wascomfortable with the use of OOAD techniques, including UML. SOADsees OOAD as too tightly coupled and granular for SOA, and so uses itas a more granular layer (see Figure 6).Figure 6. SOAD design layersSOA best practices Copyright IBM Corporation 1994, 2008. All rights reserved.Page 11 of 21

developerWorks ibm.com/developerWorksSOAD focuses on higher-level concerns at a business level, such asbusiness processes. As the development becomes more detailed,existing object-oriented techniques are used. SOAD includesSOA-specific topics such as: Service categorization and aggregation Policies and aspects Meet-in-the-middle processes Semantic brokering Service harvesting and knowledge brokering Service-oriented modeling: Mark Endrei starts with businessdecomposition, which identifies business use cases and processes (seeResources section for Endrei). When the use cases and processes moveinto the design phase, system use cases and subsystems to support theprocesses are identified. The business use cases are then used toidentify services.The next step is to identify business goals and to break them down intosubgoals (see Figure 7). The subgoals then map previously identifiedservices to the goals, thereby revealing any gaps. The goal is to identifybusiness components, so the next step is to analyze processes within thesubsytems.Figure 7. Domain decompositionSOA best practicesPage 12 of 21 Copyright IBM Corporation 1994, 2008. All rights reserved.

ibm.com/developerWorksdeveloperWorks Ali Arsanjani expounds on the methodology of SOMA (see Resourcessection for Arsanjani), detailing techniques for discovering services. Hecalls his top-down process "domain decomposition," which results inbusiness use cases. He calls his bottom-up process "existing systemanalysis," which results in candidate functionality to turn into components.Finally, he calls his middle-out process "goal-service modeling," whichidentifies potential services through a focus on business goals andperformance metrics. This is well-documented SOA methodologybecause it includes formats for artifacts, and so may be a good place tostart. Agile service-oriented modeling: Pal Krogdahl focuses on modeling thebusiness' services as well as linking business processes to services (seeFigure 8). He builds on the work of Zimmermann and Arsanjani (seeResources for Krogdahl). His value-add is to look at agile methods asapplied to SOA.Figure 8. SOA elementsSOA best practices Copyright IBM Corporation 1994, 2008. All rights reserved.Page 13 of 21

developerWorks ibm.com/developerWorksThere is no clear industry winner for SOA methodology. Until there is, choose oneand adapt it to your organization. Past history says that some blending and mergingof methodology proposals will end up as the de facto standard.Service design guidelinesWe listed key principles for an SOA and your designs should support theseprinciples. We'll turn now to some design-specific advice.Discover services based on key business initiativesThis may sound obvious, but it's worth emphasizing: One of the key goals of SOA isto have business analysts and technical staff (IT) work more cohesively. In the past,analysts were constrained by what the IT staff told them was "possible." Just as usecases have been used to drive IT efforts, business cases provide that direction in anSOA.Some SOA methodologies use business goals to drive activities and developartifacts. Of course, this means you understand your business' initiatives. If youdon't, start there; if you do, use them to discover services as a team effort betweenbusiness analysts and IT personnel.Generate message details from WSDLInteractive Development Environments (IDE) such as IBM Rational ApplicationDeveloper (RAD) will generate Web service code from a WSDL file. There is noreason to type this information in by hand.SOA best practicesPage 14 of 21 Copyright IBM Corporation 1994, 2008. All rights reserved.

ibm.com/developerWorksdeveloperWorks Optimize SOAP messagesSOAP content is XML. As you know, XML is descriptive but is typically larger due tothe volume of tags. If you have performance problems, consider using MessageTransmission Optimization Mechanism (MTOM), which builds on XML-binaryOptimized Packaging (XOP). XOP provides a more efficient serialization of XML byusing MIME encoding. MTOM uses XOP to encode portions of SOAP messages,while still presenting an XML Infoset to the SOAP application.Another, more recent alternative is to use XFire. XFire is an open source,standards-compliant SOAP framework that uses the latest technologies, including aStAX parser, to boost SOA messaging performance.Again, unless your performance is unacceptable, you should be fine with regularXML SOAP messages. However, if you are providing services to a large communityof clients, you may need to boost your performance using one of these alternatives.Streaming API for XML (StAX)StAX is a parser API that falls between the tree-navigation DOMand push event-based SAX interfaces. It works serially on an XMLdocument as SAX does, but it allows tokens to be pulled by theapplication. See the Resources section (Ryan) for more information.Provide atomic services where transactions are neededTry to make service requests as atomic as possible. One service request shouldstand on its own so that if it needs to roll back, it can do so independently of otherservices.For example, if you have a banking application and need to service a funds transfer,do that with a single . If you only provide services for the component parts of a transfer, such asdeposit(anAmount) and withdraw(anAmount), you are asking for trouble. Notonly is it more work for all your consuming applications, it is an accident waiting tohappen when the withdrawal works but the deposit fails (or vice versa). The atomicservices will include all the steps in a single transaction, ensuring an all-or-nothingapproach to the steps.This becomes especially interesting when you consider that the fromAccount andtoAccount can be at different financial companies. So, how does a (logical)transaction work across companies? Jon Maron presents more complex (andrealistic) examples of the issues in the world of distributed services and he suggestsa solution (see Resources section for Maron). The solution requires more work, asyou might expect, but meets the transactional requirements, as shown in Figure 9.Figure 9. Transaction supportSOA best practices Copyright IBM Corporation 1994, 2008. All rights reserved.Page 15 of 21

developerWorks ibm.com/developerWorksUse small, high-impact proof-of-concept servicesMaking services available can be done incrementally. You don't have to makeeverything a service at the same time. Start with an area of major benefit. Forexample, on my current job, a central part of our systems is a legacy system that is,well, to put it nicely, difficult to work with. So, we have attacked that issue firstbecause it's an area ripe for creating services for groups across the corporation.Reduce coupling between consumers and providersDuring choreography, requester processes, Web services, and systems will be wiredinto your provider services. In and of itself, this is coupling. The difference is thatESB facilities can route to updated services, handle conversion between formats,and other necessary details. This is as loose a coupling as you can get and stillreuse available services. Loose coupling is especially important when you arereusing services outside your organization.Dave Artus lists the following set of dependencies between service consumers andproviders (see Resources section for Artus): Platform: Web services provide platform independenceSOA best practicesPage 16 of 21 Copyright IBM Corporation 1994, 2008. All rights reserved.

ibm.com/developerWorksdeveloperWorks Location: SOA ESB provides dynamic routing at runtime Availability: SOA ESB supports asynchronous invocation Version: SOA ESB mediates format changesBe consistent and concise in your service invocationIf your services work the same way, choreographing a business process will beeasier for your business analysts. In addition, if you make them all workasynchronously, you remove a dependency on service availability.Conciseness relates to what Brad Cox calls "surface area": group parameters into asingle structure so the consumer only needs to provide a map structure that makes iteasy to send values to the service safely. If the service changes, the same structurecan be supported, since it is still a map. This would allow you to deprecate theprevious parameter set while still supporting it and not breaking the service forcurrent consumers!Use toolsThis may be obvious, but SOA is supposed to be responsive and flexible, so youneed tools that work well in an SOA effort. You could to use IBM's SOA tool suite,which includes WebSphere Business Modeler, Rational Application Developer(RAD) and WebSphere Integration Developer (WID) products. These products letyou develop business processes and Web services interactively and then wire themtogether into a deployable SOA application. You will need a registry and repository.IBM's WebSphere Service Registry and Repository (WSRR) is one possible solution.Without tools that are geared toward SOA development, you will find it difficult to besuccessful. Remember, SOA is a lot more than Web services.Service integration guidelinesDesignate an interface designerYou must follow standards, just as you must strive for consistency across services.According to Thomas Erl (see Resources section for Erl), the interface designer isresponsible for creating the WSDL files for Web services as well as the formatting ofrelated SOAP messages.Erl goes on to say that this interface designer should have component design andbusiness analysis skills -- someone needs to be dedicated explicitly to this role.Service management guidelinesMonitor SOA QoSMonitoring is a challenge in an SOA because the assets are potentially scatteredSOA best practices Copyright IBM Corporation 1994, 2008. All rights reserved.Page 17 of 21

developerWorks ibm.com/developerWorksaround the network, including outside your organization. Traditional monitoring toolsare great at looking at performance QoS across a single-address space or server,but they don't help much when monitoring Web services that span servers andpossibly companies. These composite applications are typical in SOAs.Monitoring is a part of the control and feedback mechanism called SOA governance.Monitoring composite applications has unique end-to-end management issues (seeResources section for Cappelli). One example of this complex issue we discussedearlier was transactions within a SOA.Monitoring QoS merely at the UI level won't uncover the underlying causes of anyissues that arise, such as performance degradation. The IBM Tivoli CompositeApplication Manager for SOA supports monitoring for an SOA.SOA GovernanceThe word governance is used extensively in the world of SOA.Governing, as we know, deals with exercising authority or controlover something or someone. In discussing SOA, it means thatservice use and registration need to be managed and monitored ina standard way. This has been a weak point for delivering reusableservices.Governance includes all stakeholders in the decision-makingprocess. All stakeholders, not just IT, are responsible for keysystems.IBM's WebSphere Service Registry and Repository (WSRR)product is a specific example of support for SOA govern

Service-Oriented Architecture (SOA) is the next step in software development, leveraging XML technologies and Web services (WS) that went before. This best practices tutorial teaches you how to use SOA techniques in system design effectively. Use this tuto