WebSphere Business Integration Primer Process Server, BPEL, SCA, and SOA by Ashok Iyengar, Vinod Jessani, and Michele Chilanti ISBN: 0-13-224831-X Using WebSphere ® Business Integration
Trang 2REGISTER YOUR BOOK
ibmpressbooks.com/ibmregister
REGISTRATION ENTITLES YOU TO:
• Supplemental materials that may be available
• Advance notice of forthcoming editions
• A coupon that can be used on your next purchase from ibmpressbooks.com
IBM PRESS NEWSLETTER
Sign up for the monthly IBM PRESS NEWSLETTER at
ibmpressbooks.com/newsletters
LEARN
• NEW PODCASTS
from your favorite authors
• ARTICLES & INTERVIEWS
with authors
• SPECIAL OFFERS
from IBM Press and partners
• NOTICES & REMINDERS
about author appearances and conferences
Visit ibmpressbooks.com for all product information
Sign up for the IBM PRESS NEWSLETTER and
you will be automatically entered into a
QUARTERLY GIVE-AWAY for 3 months access to Safari Books Online –
online access to more than 5000 books
A $150 VALUE!
Sign up at ibmpressbooks.com/newsletter
Trang 3Service-Oriented
Architecture (SOA) Compass
Business Value, Planning,
and Enterprise Roadmap
by Norbert Bieberstein, Sanjay Bose,
Marc Fiammante, Keith Jones, and Rawn Shah
ISBN: 0-13-187002-5
In this book, IBM ® Enterprise Integration Team
experts present a start-to-fi nish guide to
plan-ning, implementing, and managing
Service-Oriented Architecture Drawing on their extensive
experience helping enterprise customers migrate
to SOA, the authors share hard-earned lessons
and best practices for architects, project
manag-ers, and software development leaders alike.
Well-written and practical, Service-Oriented
Architecture Compass offers the perfect blend of
principles and “how-to” guidance for transitioning
your infrastructure to SOA The authors clearly
explain what SOA is, the opportunities it offers,
and how it differs from earlier approaches Using
detailed examples from IBM consulting
engage-ments, they show how to deploy SOA solutions
that tightly integrate with your processes and
operations, delivering maximum fl exibility and
value With detailed coverage of topics ranging
from policy-based management to workfl ow
implementation, no other SOA book offers
comparable value to workingIT professionals.
WebSphere Business Integration Primer
Process Server, BPEL, SCA, and SOA
by Ashok Iyengar, Vinod Jessani, and Michele Chilanti
ISBN: 0-13-224831-X
Using WebSphere ® Business Integration (WBI) technology, you can build an enterprise-wide Business Integration (BI) infrastructure that makes
it easier to connect any business resources and functions, so you can adapt more quickly to the demands of customers and partners Now there’s
an introductory guide to creating standards-based process and data integration solutions with WBI
WebSphere Business Integration Primer
thoroughly explains Service Component Architecture (SCA), basic business processes, and complex long-running business fl ows, and guides you to choose the right process integration architecture for your requirements Next, it intro- duces the key components of a WBI solution and shows how to make them work together rapidly and effi ciently This book will help developers, technical professionals, or managers understand today’s key BI issues and technologies, and streamline business processes by combining
BI with Service Oriented Architecture (SOA).
Related Books of Interest
Sign up for the monthly IBM Press newsletter at
ibmpressbooks/newsletters
Trang 4Related Books of Interest
Visit ibmpressbooks.com for all product information
The New Language
of Business
SOA & Web 2.0
by Sandy Carter
ISBN: 0-13-195654-X
In The New Language of Business, senior IBM
executive Sandy Carter demonstrates how to
leverage SOA, Web 2.0, and related technologies
to drive new levels of operational excellence and
business innovation.
Writing for executives and business leaders inside
and outside IT, Carter explains why fl exibility and
responsiveness are now even more crucial to
success — and why services-based strategies
offer the greatest promise for achieving them.
You’ll learn how to organize your business into
reusable process components — and support
them with cost-effective IT services that adapt
quickly and easily to change Then, using
extensive examples — including a detailed case
study describing IBM’s own experience — Carter
identifi es best practices, pitfalls, and practical
starting points for success
Listen to the author’s podcast at:
ibmpressbooks.com/podcasts
Executing SOA
A Practical Guide for the Oriented Architect
Service-by Norbert Bieberstein, Robert G Laird,
Dr Keith Jones, and Tilak Mitra
ISBN: 0-13-235374-1
In Executing SOA, four experienced SOA
implementers share realistic, proven, trenches” guidance for successfully delivering on even the largest and most complex SOA initiative This book follows up where the authors’ best-
“from-the-selling Service-Oriented Architecture Compass
left off, showing how to overcome key obstacles
to successful SOA implementation and identifying best practices for all facets of execution—
technical, organizational, and human Among the issues it addresses: introducing a services discipline that supports collaboration and information process sharing; integrating services with preexisting technology assets and strategies; choosing the right roles for new tools; shifting culture, governance, and architecture; and bringing greater agility to the entire organizational lifecycle, not just isolated projects.
Listen to the author’s podcast at:
ibmpressbooks.com/podcasts
Trang 5Related Books of Interest
Sign up for the monthly IBM Press newsletter at
by Kyle Brown, Dr Gary Craig, Greg Hester,
David Pitt, Russell Stinehour, Mark Weitzel,
Jim Amsden, Peter M Jakab, and Daniel Berg
ISBN: 0-321-18579-X
Enterprise Java™ Programming with IBM
WebSphere, Second Edition is the defi nitive guide
to building mission-critical enterprise systems
with J2EE ™ , WebSphere, and WebSphere
Studio Application Developer Fully updated for
Versions 5.x of WebSphere Application Server
and WebSphere Studio Application Developer,
it combines expert architectural best practices
with a case study that walks you through
constructing an entire system.
The authors are an extraordinary team of
WebSphere insiders: developers, consultants,
instructors, and IBM WebSphere development
team members Together, they offer
unprec-edented insight into the use and behavior of
WebSphere’s APIs in real-world environments
— and systematic guidance for delivering
systems of exceptional performance,
robustness, and business value.
IBM WebSphere and Lotus
Lamb, Laskey, Indurkhya ISBN: 0-13-144330-5
Enterprise Messaging Using JMS and IBM WebSphere
Yusuf ISBN: 0-13-146863-4
IBM WebSphere System Administration
Williamson, Chan, Cundiff, Lauzon, Mitchell ISBN: 0-13-144604-5
Outside-in Software Development
Kessler, Sweitzer ISBN: 0-13-157551-1
Enterprise Master Data Management
Dreibelbis, Hechler, Milman, Oberhofer, van Run, Wolfson ISBN: 0-13-236625-8
Trang 7This page intentionally left blank
Trang 8Step-by-Step Guide for Building
Your Own Portlets
Ibmpressbooks.com
Trang 9The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
© Copyright 2009 by International Business Machines Corporation All rights reserved.
Note to U.S Government Users: Documentation related to restricted right Use, duplication, or disclosure
is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corporation.
IBM Press Program Managers: Tara Woodman, Ellice Uffer
Cover Design: IBM Corporation
Associate Publisher: Greg Wiegand
Marketing Manager: Kourtnaye Sturgeon
Publicist: Heather Fox
Acquisitions Editor: Katherine Bull
Development Editor: Kevin Howard
Managing Editor: Kristy Hart
Designer: Alan Clements
Senior Project Editor: Lori Lyons
Copy Editor: Deadline Driven Publishing
Indexer: WordWise Publishing Services
Compositor: Nonie Ratcliff
Proofreader: Water Crest Publishing
Manufacturing Buyer: Dan Uhrig
Published by Pearson plc
Publishing as IBM Press
IBM Press offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests For more information, please contact:
U S Corporate and Government Sales
Trang 10The following terms are trademarks or registered trademarks of International Business Machines
Corporation in the United States, other countries, or both: IBM, the IBM logo, IBM Press, DB2, Domino, Domino Designer, Lotus, Lotus Notes, Rational, and WebSphere Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc in the United States, other countries, or both Microsoft, Windows, Windows NT, and the Windows logo are trademarks of the Microsoft Corporation in the United States, other countries, or both Linux is a registered trademark of Linus Torvalds Intel, Intel Inside (logo), MMX, and Pentium are trademarks of Intel Corporation in the United States, other countries, or both Other company, product, or service names may be trademarks or service marks of others.
Library of Congress Cataloging-in-Publication Data
by any means, electronic, mechanical, photocopying, recording, or likewise For information regarding permissions, write to:
Pearson Education, Inc
Rights and Contracts Department
501 Boylston Street, Suite 900
Boston, MA 02116
Fax (617) 671 3447
ISBN-13: 978-0-13-713446-5
ISBN-10: 0-13-713446-0
Text printed in the United States on recycled paper at R.R Donnelley in Crawfordsville, Indiana.
First printing September 2008
Trang 11This page intentionally left blank
Trang 12Chapter 6 Adding Basic User Interface Controls to Your Portlets 149
Trang 13This page intentionally left blank
Trang 14Introduction to the WebSphere Portlet Factory Designer 13
Trang 15Chapter 2 Providing and Consuming Services 37
Applying the Service Provider/Consumer Pattern 49
Testing the retrieveContactsView Operation 61
Trang 16Chapter 4 Using Domino Data 77
Testing the readSupplierDocument Operation 89 Testing the updateSupplierDocument Operation 90 Testing the createSupplierDocument Operation 90 Testing the deleteSupplierDocument Operation 90
Adding an Action to Retrieve a List of Assets 112
Trang 17Consuming the Service 114
The Benefits of Inter-Portlet Communication 166
Adding an Action to Retrieve a List of Loans 169
Adding a Method to Retrieve a Specific Loan 170
Trang 18Testing the Service Provider 171
Defining the Portlet as a Cooperative Source 176
Defining the Portlet as a Cooperative Target 180 Handling an Inter-Portlet Communication Event 181
Trang 19Java Beans 210
Testing the addShoppingCartItem Operation 225
Testing the viewShoppingCartItem Operation 225 Testing the updateShoppingCartItem Operation 226 Testing the deleteShoppingCartItem Operation 226 Testing the clearShoppingCart Operation 226
Implementing the updateShoppingCartItem Operation 228 Implementing the addShoppingCartItem Operation 229 Implementing the clearShoppingCart Operation 229 Implementing the deleteShoppingCartItem Operation 230
Trang 20Chapter 9 Using Web Services and Manipulating XML 239
Testing the orderStockWebService Web Service 252
Creating a Model and Defining the Service 255
Creating a Variable to Store the Request 260
Adding an Action to Retrieve Sales Data 271
Trang 21Creating a Sales Chart Portlet 273
Specifying a Method to Get the Current Sales Item 282 Specifying an Action for the getSalesArea Operation 283
Adding an Action to Display the salesAreaPage 285
Testing the Drill-Down from the salesChart Model 287
Validating, Translating, and Formatting Fields 293 Schema Typed and Non-Schema Typed Fields 294
Trang 22Adding a Submit Button 299
Adding a Link to Return to the Project Form 301
Adding Formatting, Validation, and Translation 303
Changing Messages for Regular Expressions 318
Profiling the hrHeader Based on Department 339 Profiling the itHeader Based on Department 340
Trang 23Profiling the hrAnnouncements Based on Department 340 Profiling the itAnnouncements Based on Department 340 Configuring the userDepartment Profile Set 340 Testing the companyAnnouncements Portlet 341
Adding Functionality for Retrieving Performance Data 348 Specifying the getPerformanceData Operation 350 Adding Functionality for Updating Performance Data 351 Specifying the updatePerformanceData Operation 352
Testing the getPerformanceData Operation 353
Responding to a Change in the Checkbox Value 358
Trang 24Adding Division Variables 374
Creating a Terms & Conditions Builder 401 Defining Builder Inputs for the Custom Builder 403 Generating the Custom Builder Artifacts 404 Modifying the Custom Builder’s Functionality 405
Using the Terms & Conditions Builder 407
Trang 25Chapter 16 More Techniques for Domino 413
Notes Formulas, Validation, and Translation 414
getDominoSession() and getDominoDatabase() 435
Enable HTTP Clients to Browse Databases 444
Setting Up a DB2 Database Driver Provider 452 Setting Up a SQL Server Driver Provider 453
Trang 26Using Properties 464
Avoiding Errors Caused by File Length Limitations 468
Trang 27This page intentionally left blank
Trang 28Foreword
Building good software applications is hard Improvements in languages, frameworks, and tools
do make things easier, and there are more of these improvements each year
But at the same time, the technology landscape that developers live in keeps changing andgetting more complex Just when you get productive with one set of tools and technology, there’ssomething new that you have to adapt to or integrate with And there’s a perpetual demand for
“more software quicker”—organizations can never get all the software they want as soon as theywant it
WebSphere®Portlet Factory was created to apply concepts of software automation to help
address this ongoing problem of software development complexity This software automationmoves the developer up a level, above the level of individual code artifacts Instead of directlymanipulating elements such as JSP, Java™, JavaScript, and XML files, the developer interacts
with builders in a model, and the builders then generate all the necessary code artifacts in
response to the developer’s high-level instructions
You can think of builders as encapsulations of software features or design patterns Each
builder implements one feature of an application, controlled by instructions provided by thedeveloper in a wizard-like user interface An application is built by successively adding and mod-ifying features (builders) until the application works as intended The net effect for developers isthat they can rapidly develop complex applications without having to learn (and remember) allthe underlying technology
In the past several years working with this technology, we’ve found that developers canconsistently get big productivity gains from this software automation We’ve seen the technologyadopted by an ever-increasing customer base, first at Bowstreet (where the software was initiallydeveloped), and now at IBM, which acquired Bowstreet in late 2005 At IBM, the technology has
Trang 29also been adopted by a number of other product groups that build products on top of Portlet tory technology and take advantage of its software automation For example, the Lotus®
Fac-ActiveInsight Dashboard Framework is built on Portlet Factory and provides a set of builders thatimplement high-level design patterns tailored for dashboard-style applications
We’ve also found that automation makes it possible to quickly add support for new ogy, such as integrating new back-end services or generating new user interface technologies.One example is support for Ajax (Asynchronous Java and XML) user interfaces Implementing
technol-an Ajax user interface through htechnol-and-coding is quite complex technol-and involves coordinated client-sidecode (JavaScript) and server-side code Using builder technology, a small team with Ajax exper-tise was able to capture their expertise in a set of builders that automate common Ajax patternsand generate the necessary client and server code Once the builders were created, those Ajax pat-terns became easily accessible to any developer using Portlet Factory
In this book, David Bowley gives a clear “soup-to-nuts” guide to building applications withPortlet Factory, from creating your first project, to back-end integration, to user interface andAjax techniques Each chapter tackles one aspect of application development, and for each taskDavid shows you which builders you need and how to use them In his examples, I think you’llsee that David has found just the right level of complexity—the examples are simple enough toeasily understand, but not unrealistically simple or trivial
Portlet Factory development—using builders and models instead of working directly withcode—represents a different development paradigm than with other tools I hope you find asmuch value in this automation paradigm as we have You can use this book as your guide as youlearn your way around Portlet Factory and get comfortable with this way of working
Trang 30Preface
Portlet development can often be arduous and complicated; indeed, the word “rapid” is not mally associated with building portlets IBM’s award-winning1 WebSphere Portlet Factory(WPF), however, provides developers with a wizard-based development environment that greatlyexpedites the process of building, testing, and deploying portlets WPF shields developers frommuch of the complexity of traditional portlet development, and portlets built using WPF oftenrequire little or no coding—enlarging the potential pool of people who are able to build portletapplications Having said this, WPF developers also have the full power of Java 2 Enterprise Edi-tion (J2EE) available to them should they choose to use it, making WPF a flexible (and powerful)development tool
nor-This book is about how to use WPF to rapidly build portlets No previous developmentexperience is required to understand this book, and anyone with a remote interest in portlet devel-opment should find something of interest here The book is structured to facilitate rapid portletdevelopment: It is a collection of independent chapters, each walking through the process of cre-ating a portlet while focusing on a particular aspect of WPF Due to the independent nature of thechapters (and the nature of portlet development using WPF), you can skip to the chapters thatinterest you without needing to read chapter after chapter of abstract theory and/or backgroundinformation beforehand For example, if you want to learn how to build a portlet that displays agraphical chart, skip to Chapter 10, “Using Charts in Portlets;” if you want to find out how towork Ajax into your portlets, skip to Chapter 13, “Using Ajax and Dojo.” If you are completelynew to WPF (or portals and portlets) and are looking for some basic information to get youstarted in WPF, Chapter 1, “Introduction to WebSphere Portlet Factory,” provides an overview of
1 WebSphere Portlet Factory won the 2006 JavaPro readers’ choice award for “Best Java Enterprise Portal Technology” (www.fawcette.com/javapro/).
Trang 31portal terminology, WPF architecture, and the WPF Designer interface Chapter 1 also walks youthrough the process of creating, testing, and deploying a simple Hello World! portlet Other intro-ductory information is available in Appendix A, which contains some useful information for set-ting up your WPF development environment, and there is a glossary at the back of the book thatdefines common WPF terms
This book also contains useful tidbits that I have picked up during my time with WPF—thesort of things developers need to know but normally wouldn’t without a great deal of experimen-tation and frustration These snippets of information are highlighted as follows:
By walking through each example, you will learn how to build portlets in WPF by actually
build-ing them, and not just readbuild-ing about it; so, by the end of each chapter, you should have a practical
understanding of how to work the discussed features into your own portlets
Although this book does discuss the theory of WPF portlet development, this information isdiscussed in the context of the practical examples in the book, which gives you a more concrete
Trang 32understanding of how the abstract side of portlet development is applied Readers unconcernedwith what is going on under the covers can skip the theory sections without adversely affectingtheir portlets Indeed, one of the advantages of using WPF is that you don’t need to learn vastamounts of theory to begin development—you can start building portlets right away The focus ofthis book, then, is on the practical side of portlet development, with an emphasis on rapidly build-
ing portlets with certain functionality—this is not intended as a book of theory Similarly, given
its short length, this book is not intended to cover every aspect of portlet development—onlythose areas that are deemed most useful to portlet developers (and WPF developers, in particular)
I hope you find this book useful and enjoyable to read; I certainly enjoyed writing it At theleast, I would like this book to go some way toward expediting your portlet development processand increasing your understanding of WPF If you have any comments about the content or struc-ture of the book, feel free to drop me a line at dave.bowley@gmail.com
Trang 33This page intentionally left blank
Trang 34Acknowledgments
I’d like to extend my sincerest appreciation to everyone who supported me during the process ofwriting this book In particular, I’d like to thank John Bergland and Dee Zepf for their early sup-port of the concept, and Jonathan Booth and Louise Simonds for their insightful comments andadvice I’m eternally grateful to Katherine Bull, my acquisitions editor, for her continual supportand direction throughout the project; and to Kevin Howard, my development editor, who care-fully surveyed each chapter and made many helpful suggestions Thanks also to Carlos Llopartfor the Spanish translations in Chapter 12, and to my sister Kirsten for providing several of thediagrams that appear in this book
Of course, a thank you is also due to you, the reader, for purchasing this book and investingthe time to read it I hope that this book increases your understanding of WebSphere Portlet Fac-tory and provides you with a valuable portlet development resource
Trang 35This page intentionally left blank
Trang 36About the Author
David Bowley is a consultant for e-Centric Innovations, an e-business solution provider in
Mel-bourne, Australia Over the last nine years, David has worked extensively with IBM technologies,particularly WebSphere Portal and WebSphere Portlet Factory David has a bachelor’s degree incomputing and holds numerous I.T certifications in areas such as WebSphere Portal, WebSpherePortlet Factory, Java, Lotus Notes, Net, DB2, Rational, SOA, and RUP David is a frequent con-
tributor to various technical publications, including The View and Lotus Advisor.
Trang 37This page intentionally left blank
Trang 389780137134465 under the Chapter 1 folder (instructions for copying these files into your projectare included in a readme.txt file in the same folder); however, to increase your understanding ofthe topics discussed, it is recommended that you create these files yourself by following theexample in this chapter Doing so will give you a good understanding of the basics of WPF andposition you to tackle some of the other chapters in this book.
The following topics are covered in this chapter:
• What is a portal and what are portlets?
• Portal key benefits
• What is WebSphere Portlet Factory?
• WebSphere Portlet Factory key benefits
• WebSphere Portlet Factory architecture
• Introduction to the WebSphere Portlet Factory Designer
• Building your first portlet
Trang 39What Is a Portal and What Are Portlets?
A portal is a user interface (UI) for people to interact with information and processes, often via
Web pages accessed using a Web browser (such as the portal shown in Figure 1.1) Portals are
provided by a portal server, such as WebSphere Portal Server, in a similar way to how Web pages
are provided by an ordinary Web server Portals usually aim to streamline business operations bybringing together information and processes from disparate parts of an organization Forexample, an online bookstore may provide a portal for customers to preview new releases, pur-chase new books, check the status of any current orders, and even chat with other customers toshare their thoughts on a particular book Portal functionality is normally provided through one
or more portlets, which are UI components of the portal that serve a particular function (similar
to how a window offers a particular function—or suite of functions—within a Microsoft®dows® application) In the case of an online bookstore, then, a portal might include a NewReleases portlet and a Forum portlet
Win-2 Chapter 1 Introduction to WebSphere Portlet Factory
Figure 1.1 An example portal at www.ibm.com/developerworks/.
Portlets are laid out onto various pages within the portal, each page effectively containing a
set of portlets that serves a common purpose So, a Purchase page might contain portlets for
Trang 40browsing a catalogue and for buying new books, and a Community page might contain portletsthat facilitate communication with other customers Portals don’t necessarily have to be customerfacing; for example, an intranet portal might be available only to employees, and an extranet por-tal might be available only to suppliers A portal can be anything from a simple front-end to abackend data source, to a complex collaborative tool integrating several different departmentsacross an enterprise
Due to the current bandwidth limitations of the Web, portals are usually kept relativelysimple in comparison with more traditional rich clients (like Microsoft Word, for example) Sim-ilarly, portlets are not normally as packed with features as their rich client cousins, and they offer
a more focused service As a result, portlets normally satisfy some key business requirement orprocess (either individually or in conjunction with other portlets) Having said this, portals avail-able through a Web browser can be accessed on a wide variety of platforms, using a number ofdifferent devices, and from anywhere in the world; so, potential exposure to a portal availablethrough a Web browser is vastly superior to that gained through a rich client Careful considera-tion, then, needs to be applied to the portal design process, and a portal should aim to supplementrich client applications rather than replace them
Portal Key Benefits
Depending on its exact nature, a portal usually offers one or more of the following key benefits:
• Integration of Business Functions—Probably the most common use for a portal is as
an integrator of business functions, usually across departmental or technological aries within an enterprise For example, a portal might provide portlets for accessingaccounting applications in SAP, reports on a SQL server, and email capabilities fromLotus Domino®, and it can enable you to use these portlets (and even send informationbetween them) as if they were all part of the same system This sort of integration pro-motes standardization of business processes and discourages the practice of viewing anorganization as a collection of isolated business units
bound-• Aggregation of Information—Another popular use for a portal is as an aggregator of
information—that is, as a means to bring together information from disparate locations
or data sources into a single interface (again, giving the impression that all of the mation is stored in the same place) A portal can save users from needing to use severaldifferent programs to hunt through multiple systems in search of information
infor-• Collaboration between Users—Portals often provide functionality that facilitates
communication and information sharing across an enterprise (such as document ing, email, blogs, and project team rooms)
shar-• Accessibility of Information and Services—One of the greatest features of the Web is
how it quickly and easily facilitates communication between people from vastly ent locations and backgrounds As a result, portals often provide an experience tailored