Create SOA applications using IBM WebSphere Dashboard Framework

3,196 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,196
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
39
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Create SOA applications using IBM WebSphere Dashboard Framework

  1. 1. Create SOA applications using IBM WebSphere Dashboard Framework Skill Level: Intermediate Zhao Hui Nie (niezh@cn.ibm.com) 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
  2. 2. developerWorks® ibm.com/developerWorks models and import them into the project.) Let's start by following the steps below to create a dashboard project: 1. Click the New menu to open the New Project window, then select the WebSphere 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 this sample, you leverage the Microsoft® Excel file as the back-end data source: 2. Select the Excel Extension feature set, which provides the artifacts for Excel files integration (see Figure 2). 3. Select the Dashboard Framework feature set. This provides the artifacts for creating high-level builders, such as Record List and Details, which you use in the sample. Figure 2. Select feature sets for the project Create SOA applications using IBM WebSphere Dashboard Framework Page 2 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  3. 3. ibm.com/developerWorks developerWorks® Now you need to configure the deployment environment. In this article, you run the models on IBM WebSphere Application Server. 4. Add the configuration for the project to be deployed on WebSphere Application Server. Figure 3 shows an example for the WebSphere Application Server configuration. You may need to change the inputs according to your environment. In addition to that, WebSphere Dashboard Framework lets you deploy the model as a portlet on a portlet server. So in this step you can add the configuration for the deployment on IBM WebSphere Portal Server if you want to create a portlet on the portal Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 3 of 23
  4. 4. developerWorks® ibm.com/developerWorks server. (Find more information about how to add the deployment configuration in the help documents by clicking Help > Help Contents in Eclipse, then clicking the Deployment topic in IBM WebSphere Portlet Factory Designer.) Figure 3. Add deployment configuration for the project 5. Click Finish to complete the project creation and automatically deploy the WAR package to the application server. The following steps show you how to create service provider model and server consumer model for the SOA application. You can also get the sample models created from the Download section. To use the sample models, right-click the project, 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 or services and expose the interface to the client application. You can find these kinds of artifacts (services operation and service definition) in WebSphere Portlet Factory. Create SOA applications using IBM WebSphere Dashboard Framework Page 4 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  5. 5. ibm.com/developerWorks developerWorks® 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 builders at design time and works as an application or portlet in a WebSphere Application Server or WebSphere Portlet Server at run time. You can add the builders in the model 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 just created, 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. Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 5 of 23
  6. 6. developerWorks® ibm.com/developerWorks 3. Click Next and go to the Select Model panel. By default, WebSphere Portlet Factory provides a couple of template models for service providers and server consumers. These template models are only for database integration. For other kinds of back-end data sources, such as Excel files, XML data sources, or data warehouse systems, you have to create another model to integrate with them. In this sample, you use the Excel file for the data source. To make sure you understand 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 the server-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 Create SOA applications using IBM WebSphere Dashboard Framework Page 6 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  7. 7. ibm.com/developerWorks developerWorks® 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 with these systems, WebSphere Portlet Factory provides a comprehensive list of builders, 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 the back-end system without writing lots of code. You need to add the specific builders in the model and do some necessary configurations. To simplify the sample in this article, 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 Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 7 of 23
  8. 8. developerWorks® ibm.com/developerWorks 2. From the Builder Picker window, select Excel Import – Enhanced, and click OK to add a new builder instance in the model, as shown in Figure 8. Figure 8. Configure the builder inputs for Excel Import - Enhancement Now you need to add the necessary configuration in the builder inputs to configure the connection. Figure 8 shows the builder inputs required for this application. For the other builder inputs, just leave them as a default. (You can find more details about using those inputs in the help document by clicking Help > Help Contents in Create SOA applications using IBM WebSphere Dashboard Framework Page 8 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  9. 9. ibm.com/developerWorks developerWorks® Eclipse and going to the Builder helper topic in IBM WebSphere Portlet Factory Designer). 3. Name: Enter the name of this builder, for example ExcelDemo. This builder generates the variables and methods according to the name. 4. File To Import: Select the Excel file that contains the needed data. You can 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 the data (see Figure 9). Note: Before you select the local file, you should import this file into the project. (You can get the Excel file from the Download section.) Figure 9. Select the Excel file Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 9 of 23
  10. 10. developerWorks® ibm.com/developerWorks 5. Content Selection Method: This builder provides three options for selecting content from the Excel file. For this sample, select Bounded to manually select a range of the content from the Excel file. You set the range 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 column and row to be imported. Click the cell that you selected to be the upper-left cell (see Figure 10). Figure 10. Specify the range of the content in the Excel file Create SOA applications using IBM WebSphere Dashboard Framework Page 10 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  11. 11. ibm.com/developerWorks developerWorks® 8. Lower Right Cell: Similar to the upper left cell, select the lower-right cell that contains the last column and row to be imported. Create a data service definition The Service Definition builder and Service Operation builder in WebSphere Portlet Factory are the major builds for creating a service interface in the service provider model. The Service Definition builder can create a service with one or more operations. You can use this service from another WebSphere Portlet Factory model using lightweight Java™ execution, or you can make it available to other applications via Web Services Description Language (WSDL) and SOAP. Open the Builder Picker window again and select the service definition builder to add 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 contain any operations. After the service shell is created by this builder, you use the Service Operation builder to add specific services to it, as demonstrated in Figure 11. Figure 11. Builder inputs of Service Definition Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 11 of 23
  12. 12. developerWorks® ibm.com/developerWorks A data service created by this builder can be invoked in another model if that model contains a Service Consumer builder. When you create a data service with this builder, you can also opt to expose the service as a WSDL SOAP service. The next section 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 an operation to the service created by the Service Definition builder. The operation typically invokes some data-access functionality that's available in the model. Data access is usually provided by back-end integration builders (such as an SAP function, an SQL call, or an Excel document) and can also be provided by a linked Java object or a data-returning method. Here, list only the inputs required for this application, leaving the default values for the others (see Figure 12). (You can find more details for other inputs in the builder help document.) Figure 12. Configure the builder inputs for the Service Operation builder Create SOA applications using IBM WebSphere Dashboard Framework Page 12 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  13. 13. ibm.com/developerWorks developerWorks® 1. Data Service: Select the data service that you just added in the model. 2. Operation Name: Specify the name of the operation. This builder generates 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.getContentXml method 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 the Specify result schema radio button, and click the button to select the schema that was generated by the Excel Import – Enhanced builder. Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 13 of 23
  14. 14. developerWorks® ibm.com/developerWorks You've created the service provider model, which will expose the getDemoData operation for the access from other service consumer models. Next let's create the service consumer model, which uses the data you got from the service provider model 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 the front-end interfaces to customers. The service consumer model in this sample runs as a Web application that shows a table to display the data you got from the service provider. Add the model in the project Follow the same steps you completed in the previous section to create an empty model 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 Service Operation builders. It's used to provide access to a public service created by those builders 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 Create SOA applications using IBM WebSphere Dashboard Framework Page 14 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  15. 15. ibm.com/developerWorks developerWorks® 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 of records 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 or data service. Figure 14 shows only the record list page: 1. Add a Record List and Detail builder instance in the model, following the steps below to specify the builder inputs. Figure 14. Configure the builder inputs for Record List Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 15 of 23
  16. 16. developerWorks® ibm.com/developerWorks 2. Name: Enter a name in this field. The builder generates the list page and details page according to the name you enter here. 3. Pages To Create: Check the Record List Page box, and clear the Record 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 set from the service provider. The method is called by the main action to load the data for the Record List page. 6. Record List Data: You can set a variable or a data service that contains the data to be displayed in the record list page. You've created the service provider model and service consumer model for the application. Next you run the application on the WebSphere Application Server. Run the model Create SOA applications using IBM WebSphere Dashboard Framework Page 16 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  17. 17. ibm.com/developerWorks developerWorks® Before you run the model, make sure you've set the project deployment configuration correctly. In the first section, you added the configurations for the WebSphere Application Server and deployed the models to the application server automatically. To run the service consumer model, right-click the service consumer model and click Run As > Run. The IDE launches a browser to show the page generated by the service 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 for access from other client applications. The Service Provider builder enables you to expose the model as a Web service. Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 17 of 23
  18. 18. developerWorks® ibm.com/developerWorks 1. Open the Service Provider builder again. 2. Check the Generate WSDL box to enable the service to be available by WSDL 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 builder works. Open the Testing Support section, and check the Add Testing Support 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 by this model, as shown in Figure 18. Figure 18. Run the test for the Web service Create SOA applications using IBM WebSphere Dashboard Framework Page 18 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  19. 19. ibm.com/developerWorks developerWorks® 5. On this page, click the View WSDL link to view the WSDL file generated by 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 to consume the Web service created by the service provider model. Conclusion Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 19 of 23
  20. 20. developerWorks® ibm.com/developerWorks This article walked you through how to create an SOA application using WebSphere Dashboard Framework. WebSphere Dashboard Framework provides an efficient way to build flexible, reusable SOA applications. And by encapsulating your back-end data and processes into a set of well-defined services, you can achieve high levels of reuse across your dashboard project and even across other types of applications within your organization. Create SOA applications using IBM WebSphere Dashboard Framework Page 20 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  21. 21. ibm.com/developerWorks developerWorks® Downloads Description Name Size Download method Sample code for this article DashboardSOASample.zip 5KB HTTP Information about download methods Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 21 of 23
  22. 22. developerWorks® ibm.com/developerWorks Resources Learn • Read http://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 portlets using WebSphere Portlet Factory. • Get the WebSphere Dashboards documentation. • Check out the WebSphere Portlet Factory samples to learn more about using builders in WebSphere Portlet Factory. • The SOA and Web services zone on IBM developerWorks hosts hundreds of informative articles and introductory, intermediate, and advanced tutorials on how 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 you get 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 for download or on DVD. Discuss • Participate in the discussion forum for this content. • Get involved in the developerWorks community by participating in developerWorks blogs. About the author Zhao Hui Nie Zhao Hui is a software engineer with the WebSphere Dashboard Framework development team in the IBM China Software Development Lab. He designs and develops basic builders for WebSphere Dashboard Framework. Create SOA applications using IBM WebSphere Dashboard Framework Page 22 of 23 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  23. 23. ibm.com/developerWorks developerWorks® Trademarks IBM, the IBM logo, developerWorks, Domino, Lotus, and WebSphere are registered trademarks of IBM in the United States, other countries or both. Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks 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 the United States, other countries, or both. Microsoft and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Create SOA applications using IBM WebSphere Dashboard Framework © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 23 of 23

×