23
Create SOA applications using IBM WebSphere Dashboard Framework Skill Level: Intermediate Zhao Hui Nie ([email protected]) Software Engineer IBM 21 Mar 2008 Want a new way to create Service-Oriented Architecture (SOA) applications? Check out IBM® WebSphere® Dashboard Framework. With this powerful and flexible tool, you can build role-based dashboards on top of an SOA. Learn how to use its comprehensive builders to create complex SOA applications quickly without having to write a lot of code. To follow along with this article, you should have a good understanding of IBM WebSphere Portlet Factory, WebSphere Dashboard Framework, and Web services. Introduction WebSphere Dashboard Framework augments WebSphere Portlet Factory by adding dashboard-specific features and a set of dashboard-specific design builders, such as Record List and Details, Summary Drill Down, Map, and Annotation. With the artifacts provided by WebSphere Portlet Factory, including the Service Provider builder, Service Definition builder, and Service Consumer builder, you can create a service-oriented application quickly. This article uses a sample to show you how to create a service-oriented application using WebSphere Dashboard Framework. Create a Dashboard project A dashboard project contains all the artifacts required by WebSphere Portlet Factory to build the portlet or Web application. To demo the sample in this article, you need to create a dashboard project first, then create the service provider model and service consumer model for the SOA application. (You can also download the Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 1 of 23

Create SOA applications using IBM WebSphere Dashboard Framework

  • Upload
    zubin67

  • View
    3.021

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Create SOA applications using IBM WebSphere Dashboard Framework

Create SOA applications using IBM WebSphereDashboard FrameworkSkill Level: Intermediate

Zhao Hui Nie ([email protected])Software EngineerIBM

21 Mar 2008

Want a new way to create Service-Oriented Architecture (SOA) applications? Checkout IBM® WebSphere® Dashboard Framework. With this powerful and flexible tool,you can build role-based dashboards on top of an SOA. Learn how to use itscomprehensive builders to create complex SOA applications quickly without having towrite a lot of code. To follow along with this article, you should have a goodunderstanding of IBM WebSphere Portlet Factory, WebSphere DashboardFramework, and Web services.

Introduction

WebSphere Dashboard Framework augments WebSphere Portlet Factory by addingdashboard-specific features and a set of dashboard-specific design builders, such asRecord List and Details, Summary Drill Down, Map, and Annotation. With theartifacts provided by WebSphere Portlet Factory, including the Service Providerbuilder, Service Definition builder, and Service Consumer builder, you can create aservice-oriented application quickly. This article uses a sample to show you how tocreate a service-oriented application using WebSphere Dashboard Framework.

Create a Dashboard project

A dashboard project contains all the artifacts required by WebSphere Portlet Factoryto build the portlet or Web application. To demo the sample in this article, you needto create a dashboard project first, then create the service provider model andservice consumer model for the SOA application. (You can also download the

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 1 of 23

Page 2: Create SOA applications using IBM WebSphere Dashboard Framework

models and import them into the project.) Let's start by following the steps below tocreate a dashboard project:

1. Click the New menu to open the New Project window, then select theWebSphere Portlet Factory Project.Figure 1. Create WebSphere Portlet Factory Project

Now you need to select the feature sets which are required by this project. In thissample, you leverage the Microsoft® Excel file as the back-end data source:

2. Select the Excel Extension feature set, which provides the artifacts forExcel files integration (see Figure 2).

3. Select the Dashboard Framework feature set. This provides the artifactsfor creating high-level builders, such as Record List and Details, whichyou use in the sample.Figure 2. Select feature sets for the project

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 2 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 3: Create SOA applications using IBM WebSphere Dashboard Framework

Now you need to configure the deployment environment. In this article, you run themodels on IBM WebSphere Application Server.

4. Add the configuration for the project to be deployed on WebSphereApplication Server. Figure 3 shows an example for the WebSphereApplication Server configuration. You may need to change the inputsaccording to your environment. In addition to that, WebSphere DashboardFramework lets you deploy the model as a portlet on a portlet server. Soin this step you can add the configuration for the deployment on IBMWebSphere Portal Server if you want to create a portlet on the portal

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 3 of 23

Page 4: Create SOA applications using IBM WebSphere Dashboard Framework

server. (Find more information about how to add the deploymentconfiguration in the help documents by clicking Help > Help Contents inEclipse, then clicking the Deployment topic in IBM WebSphere PortletFactory Designer.)Figure 3. Add deployment configuration for the project

5. Click Finish to complete the project creation and automatically deploy theWAR package to the application server.

The following steps show you how to create service provider model and serverconsumer model for the SOA application. You can also get the sample modelscreated from the Download section. To use the sample models, right-click theproject, and select Import to import the download package to the project.

Create a service provider model

A service provider model gives you the ability to access the back-end data orservices and expose the interface to the client application. You can find these kindsof artifacts (services operation and service definition) in WebSphere Portlet Factory.

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 4 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 5: Create SOA applications using IBM WebSphere Dashboard Framework

Now let's use these builders to create the service provider model.

Add a model in the project

A model in the WebSphere Portlet Factory project contains a list of calls to buildersat design time and works as an application or portlet in a WebSphere ApplicationServer or WebSphere Portlet Server at run time. You can add the builders in themodel to build up your applications.

Here you create a model for the service provider application:

1. To create an empty model in the project, right-click the project you justcreated, and select New > Others to open the window shown in Figure 4.Figure 4. Create WebSphere Portlet Factory Model

2. Select the WebSphere Portlet Factory Model.

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 5 of 23

Page 6: Create SOA applications using IBM WebSphere Dashboard Framework

3. Click Next and go to the Select Model panel.By default, WebSphere Portlet Factory provides a couple of templatemodels for service providers and server consumers. These templatemodels are only for database integration. For other kinds of back-enddata sources, such as Excel files, XML data sources, or data warehousesystems, you have to create another model to integrate with them. In thissample, you use the Excel file for the data source. To make sure youunderstand the whole process of creating a service-oriented application,let's create this new model from an empty model, shown in Figure 5.

Figure 5. Create an empty model

4. Click Next and type the model's name.

5. Click Finish to complete the model creation.

After the model has been created, you add builders in the model to create theserver-side service. These builders provide the ability to access the back-end data,create a service operation, and expose the service interfaces.

Add back-end data access builders

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 6 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 7: Create SOA applications using IBM WebSphere Dashboard Framework

On the server side, the data might come in a variety of formats, including Excel files,a database, an IBM Lotus® Domino® server, or an SAP server. To integrate withthese systems, WebSphere Portlet Factory provides a comprehensive list ofbuilders, as shown in Figure 6.

Figure 6. Builders for integrating with back-end system

With these builders, you can easily add the ability in the model to access theback-end system without writing lots of code. You need to add the specific buildersin the model and do some necessary configurations. To simplify the sample in thisarticle, you use an Excel file as the data source:

1. Add an Excel Import – Enhanced builder in the service provider model(see Figure 7).Figure 7. Add the Excel Import – Enhanced builder to the model

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 7 of 23

Page 8: Create SOA applications using IBM WebSphere Dashboard Framework

2. From the Builder Picker window, select Excel Import – Enhanced, andclick OK to add a new builder instance in the model, as shown in Figure8.Figure 8. Configure the builder inputs for Excel Import -Enhancement

Now you need to add the necessary configuration in the builder inputs to configurethe connection. Figure 8 shows the builder inputs required for this application. Forthe other builder inputs, just leave them as a default. (You can find more detailsabout using those inputs in the help document by clicking Help > Help Contents in

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 8 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 9: Create SOA applications using IBM WebSphere Dashboard Framework

Eclipse and going to the Builder helper topic in IBM WebSphere Portlet FactoryDesigner).

3. Name: Enter the name of this builder, for example ExcelDemo. Thisbuilder generates the variables and methods according to the name.

4. File To Import: Select the Excel file that contains the needed data. Youcan specify a file in the project or a reference that can be set at run time.For this example, you select the Excel file in the project that contains thedata (see Figure 9). Note: Before you select the local file, you shouldimport this file into the project. (You can get the Excel file from theDownload section.)Figure 9. Select the Excel file

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 9 of 23

Page 10: Create SOA applications using IBM WebSphere Dashboard Framework

5. Content Selection Method: This builder provides three options forselecting content from the Excel file. For this sample, select Bounded tomanually select a range of the content from the Excel file. You set therange of the content in the next builder inputs.

6. Sheet: Select Sheet1 from the Excel document.

7. Upper Left Cell: Specify the upper-left cell that contains the first columnand row to be imported. Click the cell that you selected to be theupper-left cell (see Figure 10).Figure 10. Specify the range of the content in the Excel file

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 10 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 11: Create SOA applications using IBM WebSphere Dashboard Framework

8. Lower Right Cell: Similar to the upper left cell, select the lower-right cellthat contains the last column and row to be imported.

Create a data service definition

The Service Definition builder and Service Operation builder in WebSphere PortletFactory are the major builds for creating a service interface in the service providermodel. The Service Definition builder can create a service with one or moreoperations. You can use this service from another WebSphere Portlet Factory modelusing lightweight Java™ execution, or you can make it available to otherapplications via Web Services Description Language (WSDL) and SOAP.

Open the Builder Picker window again and select the service definition builder toadd a new builder instance in the model. You can see the builder inputs in Figure 11.A data service created by this builder is initially an empty shell that doesn't containany operations. After the service shell is created by this builder, you use the ServiceOperation builder to add specific services to it, as demonstrated in Figure 11.

Figure 11. Builder inputs of Service Definition

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 11 of 23

Page 12: Create SOA applications using IBM WebSphere Dashboard Framework

A data service created by this builder can be invoked in another model if that modelcontains a Service Consumer builder. When you create a data service with thisbuilder, you can also opt to expose the service as a WSDL SOAP service. The nextsection describes how to expose the service as a Web service.

Add a Service Operation builder

In the service provider model, you use the Service Operation builder to add anoperation to the service created by the Service Definition builder. The operationtypically invokes some data-access functionality that's available in the model. Dataaccess is usually provided by back-end integration builders (such as an SAPfunction, an SQL call, or an Excel document) and can also be provided by a linkedJava object or a data-returning method.

Here, list only the inputs required for this application, leaving the default values forthe others (see Figure 12). (You can find more details for other inputs in the builderhelp document.)

Figure 12. Configure the builder inputs for the Service Operation builder

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 12 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 13: Create SOA applications using IBM WebSphere Dashboard Framework

1. Data Service: Select the data service that you just added in the model.

2. Operation Name: Specify the name of the operation. This buildergenerates a corresponding variable and method based on this name.

3. Action To Call: Select the action or method that this operation will call.Click the button and select the method generated by the Excel

Import – Enhanced builder, which is called ExcelDeom.getContentXml.

4. Input Structure Handling: Because the ExcelDeom.getContentXmlmethod doesn't require inputs, select No inputs for this field.

5. Result Structure Handling and Result Schema: In these two fields,specify the schema for the result returned from this operation. Click theSpecify result schema radio button, and click the button to select

the schema that was generated by the Excel Import – Enhanced builder.

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 13 of 23

Page 14: Create SOA applications using IBM WebSphere Dashboard Framework

You've created the service provider model, which will expose the getDemoDataoperation for the access from other service consumer models. Next let's create theservice consumer model, which uses the data you got from the service providermodel to generate a high-level report to the end user.

Create a service consumer model

A service consumer model works as a client application, which provides thefront-end interfaces to customers. The service consumer model in this sample runsas a Web application that shows a table to display the data you got from the serviceprovider.

Add the model in the project

Follow the same steps you completed in the previous section to create an emptymodel in the project, and name it ServiceConsumer.model.

Add a Service Consumer builder in the model

The Service Consumer builder works with the Service Definition and ServiceOperation builders. It's used to provide access to a public service created by thosebuilders in a service provider model.

1. Click the button next to the Provider Model field and select the

model you created in the previous section.

2. Check the Add All Provider Operations box.

Figure 13. Configure builder inputs for the Service Consumer builder

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 14 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 15: Create SOA applications using IBM WebSphere Dashboard Framework

Add Record List and Details builder to show the data

A Record List and Details builder is used to create pages that display a list ofrecords and record details. The builder creates a record list page or a detail page.Record details may come from a row in the record list or from a different source ordata service. Figure 14 shows only the record list page:

1. Add a Record List and Detail builder instance in the model, following thesteps below to specify the builder inputs.Figure 14. Configure the builder inputs for Record List

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 15 of 23

Page 16: Create SOA applications using IBM WebSphere Dashboard Framework

2. Name: Enter a name in this field. The builder generates the list page anddetails page according to the name you enter here.

3. Pages To Create: Check the Record List Page box, and clear theRecord Detail Page box.

4. Create Main Action: Select Yes to create a main action in WebApp,which calls the initialize action to load data for the record list page.

5. Action To Load Data: Click the button and select the method

generated by the Service Consumer builder, which can return a data setfrom the service provider. The method is called by the main action to loadthe data for the Record List page.

6. Record List Data: You can set a variable or a data service that containsthe data to be displayed in the record list page.

You've created the service provider model and service consumer model for theapplication. Next you run the application on the WebSphere Application Server.

Run the model

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 16 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 17: Create SOA applications using IBM WebSphere Dashboard Framework

Before you run the model, make sure you've set the project deploymentconfiguration correctly. In the first section, you added the configurations for theWebSphere Application Server and deployed the models to the application serverautomatically.

To run the service consumer model, right-click the service consumer model and clickRun As > Run. The IDE launches a browser to show the page generated by theservice consumer model (see Figure 15).

Figure 15. Application UI of SOA demo

Extend the service provide model

As mentioned, the service provider model can also be exposed as a Web service foraccess from other client applications. The Service Provider builder enables you toexpose the model as a Web service.

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 17 of 23

Page 18: Create SOA applications using IBM WebSphere Dashboard Framework

1. Open the Service Provider builder again.

2. Check the Generate WSDL box to enable the service to be available byWSDL and SOAP (see Figure 16).Figure 16. Extend service definition as a Web service

3. Service definition also provides an option for test support at design time,so you can try to run the service provider model to see how this builderworks. Open the Testing Support section, and check the Add TestingSupport box (see Figure 17).Figure 17. Add testing support in the builder UI

4. Save the model, and run it again. You should see the page generated bythis model, as shown in Figure 18.Figure 18. Run the test for the Web service

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 18 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 19: Create SOA applications using IBM WebSphere Dashboard Framework

5. On this page, click the View WSDL link to view the WSDL file generatedby this service (see Figure 19).Figure 19. The WSDL file generated by the Web service

According to this WSDL file, users can develop other kinds of applications toconsume the Web service created by the service provider model.

Conclusion

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 19 of 23

Page 20: Create SOA applications using IBM WebSphere Dashboard Framework

This article walked you through how to create an SOA application using WebSphereDashboard Framework. WebSphere Dashboard Framework provides an efficientway to build flexible, reusable SOA applications. And by encapsulating yourback-end data and processes into a set of well-defined services, you can achievehigh levels of reuse across your dashboard project and even across other types ofapplications within your organization.

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 20 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 21: Create SOA applications using IBM WebSphere Dashboard Framework

Downloads

Description Name Size Download method

Sample code for this article DashboardSOASample.zip5KB HTTP

Information about download methods

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 21 of 23

Page 22: Create SOA applications using IBM WebSphere Dashboard Framework

Resources

Learn

• Readhttp://www-128.ibm.com/developerworks/edu/os-dw-os-ag-webspheregeron-i.html"Developing portlets using Eclipse and WebSphere Portlet Factory"(developerWorks, Jun 2006) for a step-by-step guide to developing portletsusing WebSphere Portlet Factory.

• Get the WebSphere Dashboards documentation.

• Check out the WebSphere Portlet Factory samples to learn more about usingbuilders in WebSphere Portlet Factory.

• The SOA and Web services zone on IBM developerWorks hosts hundreds ofinformative articles and introductory, intermediate, and advanced tutorials onhow to develop Web services applications.

• Play in the IBM SOA Sandbox! Increase your SOA skills through practical,hands-on experience with the IBM SOA entry points.

• The IBM SOA Web site offers an overview of SOA and how IBM can help youget there.

• Stay current with developerWorks technical events and webcasts.

• Browse for books on these and other technical topics at the Safari bookstore.

• Check out a quick Web services on demand demo.

Get products and technologies

• Innovate your next development project with IBM trial software, available fordownload or on DVD.

Discuss

• Participate in the discussion forum for this content.

• Get involved in the developerWorks community by participating indeveloperWorks blogs.

About the author

Zhao Hui NieZhao Hui is a software engineer with the WebSphere Dashboard Frameworkdevelopment team in the IBM China Software Development Lab. He designs anddevelops basic builders for WebSphere Dashboard Framework.

developerWorks® ibm.com/developerWorks

Create SOA applications using IBM WebSphere Dashboard FrameworkPage 22 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 23: Create SOA applications using IBM WebSphere Dashboard Framework

Trademarks

IBM, the IBM logo, developerWorks, Domino, Lotus, and WebSphere are registeredtrademarks of IBM in the United States, other countries or both.Adobe, the Adobe logo, PostScript, and the PostScript logo are either registeredtrademarks or trademarks of Adobe Systems Incorporated in the United States,and/or other countries.Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in theUnited States, other countries, or both.Microsoft and the Windows logo are trademarks of Microsoft Corporation in theUnited States, other countries, or both.

ibm.com/developerWorks developerWorks®

Create SOA applications using IBM WebSphere Dashboard Framework© Copyright IBM Corporation 1994, 2007. All rights reserved. Page 23 of 23