Skip to main content link. Accesskey S
  • Anonymous
  • Log on
  • Help
  • IBM logo
  • IBM Connections wiki
  • All Wikis
  • Home
  • Community Articles
  • Product Documentation
  • Learning Center


Search

Advanced Search

Categories

Tag Cloud

  • 1.0
  • 1.0.x
  • 2.0
  • 2.0.1
  • 2.0.1.1
  • 2.0_media
  • 2.5
  • 2.5_deployment
  • 2.5_media
  • 2.5_performance
  • 3
  • 3.0
  • 3.0.1
  • 3.0.1_media
  • 3.0_media
  • 3_deployment
  • 8.1.1
  • 8.2
  • activities
  • administrators
  • api
  • best_practices
  • blogs
  • bookmarks
  • business_card
  • cluster
  • communities
  • community
  • community_manager
  • connections
  • connections_3
  • connections_301
  • customization
  • customize
  • customizing
  • demos
  • deploying
  • deployment
  • deployments
  • developers
  • dogear
  • Domino
  • Edge server
  • education
  • error messages
  • files
  • forums
  • getting_started
  • Help
  • home
  • home_page
  • homepage
  • how-to
  • HTTP server
  • ibm
  • index
  • installation
  • integration
  • iOS
  • ipad
  • iWidget
  • J2EE
  • javadoc
  • lc3.0
  • learning
  • lotus-connections
  • mml
  • mobile
  • Notes
  • performance
  • person_card
  • Portal
  • portlet
  • portlet_factory
  • profiles
  • proxy server
  • quickr
  • Redbooks
  • rest
  • reverse proxy server
  • Sametime
  • scenarios
  • search
  • security
  • self-paced
  • SSO
  • tags
  • test_infrastructure
  • troubleshooting
  • tuning
  • video
  • VideoFest
  • videos
  • WAI
  • WAS
  • web_seminar
  • WebAppIntegrator
  • WebSphere
  • widgets
  • wikis
InformationInformation
You are currently viewing machine translated content. IBM translation might be available. Click IBM Translated Product Documentation to see what is available.X


Home > IBM Redbooks: Customizing IBM Connections 3.0.1 > 10.2 Office Supplies service provider
Rate this article 1 starRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

10.2 Office Supplies service provider 

expanded Abstract
collapsed Abstract
No abstract provided.
ShowTable of Contents
HideTable of Contents
  • 1 Creating the Office Supplier model
  • 2 Adding builders to the model
    • 2.1 Step 1: Adding a service definition builder
    • 2.2 Step 2: Creating the method for retrieving data
    • 2.3 Step 3: Creating the action for retrieving data
    • 2.4 Step 4: Adding SimpleSchema Generator builder
    • 2.5 Step 5: Adding Service Operations builder
  • 3 Office service provider model summary
Previous | Next

After creating an IBM Web Experience Factory web application project as described in 10.1 Office supplies IBM Web Experience Factory project, you can now create the office supplies service provider model. This service provider provides a uniform way to access the office supplies database. It is useful not only for our sample application here, but also for any future applications for Dan Misawa's company (our fictitious employee) that require access to that database. The consumer is not limited to other applications that are developed with Web Experience Factory. When creating a service provider in Web Experience Factory, you have the option to make the service public and generate the WSDL. Any external applications that have the capability to consume a web service can become the service consumer for the office supplies service provider.

To make this sample easy to run in your environment, we chose not to connect to a database. Instead, we get the data from a fixed XML variable. Refer to the data access samples in the Web Experience Factory wiki for examples about how to create service providers that get their data from various data sources (for example, DB2, Oracle, PeopleSoft, SAP, Domino, and much more).

Creating the Office Supplier model


Use the following procedure to create the office supplies service provider model.
  1. Right-click the OfficeSupplies project and select New -> WebSphere Portlet Factory Model from the context menu.
  2. The Choose Project dialog box displays with OfficeSupplies selected by default, because you create the model using the project's context menu. Click Next.
  3. Select Empty from the "Factory Starter Models" as the model type. Click Next.
  4. During the "Save New Model" step, you want to put the service provider model under the redwiki/data folder. Therefore, append "redwiki/data" to the "Enter or select the folder" and set the model name to "OfficeSuppliesProvider" .
  5. Click Finish.

Adding builders to the model


Now, you can add builders to the Office Supplies service provider model:
  • Service Definition
  • Variable
  • Action List
  • Simple Schema Generator
  • Service Operator

The detailed steps for adding the builders are covered later in this article, but the figure below shows the finished model.

Step 1: Adding a service definition builder


Use the following procedure to add a service definition builder.
  1. Click the add builder icon to add a builder to the builder call list.
  2. The Builder Picker dialog box displays. Select Service Definition from the "All" category.
    Tip:
    You can start typing the first letter of the builder in the builder picker dialog box to help you find the builder faster. For example, start typing the letter s in the builder list to bring you to the builders which name starts with s.
  3. Enter a descriptive name for the builder, such as OfficeSupplies.
  4. Expand the Testing Support section and click Add Testing Support . This action also enables the "Generate Main" checkbox automatically.
  5. Leave the default values for the remainder of the parameters in the builder.
  6. Click OK to finish the process.
    The figure below shows the finished builder.

Step 2: Creating the method for retrieving data


Create a variable builder for retrieving data. To add the variable builder, use the following procedure.
  1. Click the add builder icon.
  2. Select Variable from the All category.
  3. Enter suppliesData for the builder name.
  4. Select XML for the builder type.
  5. Enter the XML text shown in the following example in the initial value of the builder. Click OK .
    <office_supplies>
    <office_supply>
    <name>Compass</name>
    <qty_instock>100</qty_instock>
    <price>14.95</price>
    <img_file>compass.jpg</img_file>
    <comments></comments>
    </office_supply>
    <office_supply>
    <name>Staples</name>
    <qty_instock>50</qty_instock>
    <price>2.95</price>
    <img_file>staples.jpg</img_file>
    <comments></comments>
    </office_supply>
    <office_supply>
    <name>Poster</name>
    <qty_instock>75</qty_instock>
    <price>1.95</price>
    <img_file>poster.jpg</img_file>
    <comments></comments>
    </office_supply>
    <office_supply>
    <name>Desk Calendar</name>
    <qty_instock>20</qty_instock>
    <price>9.95</price>
    <img_file>deskcalendar.jpg</img_file>
    <comments></comments>
    </office_supply>
    </office_supplies>

The figure below shows the finished builder.

Step 3: Creating the action for retrieving data


To add the action list builder, follow these steps:
  1. Click the add builder icon.
  2. Select Action List from the All category.
  3. Enter returnSupplies for the builder name.
  4. Select IXml for the return type.
  5. Leave XML Type as Untyped XML
  6. Under Action List, click the button, and select Return from the Special folder.
  7. Click the button to select the source.
  8. Click OK. three times.
    The action list builder should look similar to the figure shown below.
  9. Leave the default values for the remainder of the builder parameters.
  10. Click OK to finish.

Step 4: Adding SimpleSchema Generator builder


To add the simple schema generator builder, follow these steps:
  1. Click the add builder icon.
  2. Select Simple Schema Generator from the All category.
  3. Enter OfficeSuppliesSchema for the builder name.
  4. Select the suppliesData variable from the sample data drop-down menu.
  5. Leave the default values for the remainder of the builder parameters.
  6. Click OK to finish.
    The figure below shows the finished builder.

Step 5: Adding Service Operations builder


To add the service operations builder, follow these steps:
  1. Click the add builder icon.
  2. Select Service Operation from the All category.
  3. Check that OfficeSupplies is pre-filled for the data service.
  4. Enter getSupplies for the operation name.
  5. Click the button in Action To Call, and select returnSupplies from Methods.
  6. Enter return the list of available office supplies for the operation description.
  7. Under the Operation Inputs section, select No inputs.
  8. Under Operational Results click the button for Result Schema, and select OfficeSuppliesSchema -> office_supplies.
  9. Leave the default values for the remainder of the builder parameters.
  10. Click OK to finish.
The finished builder figure shown below shows that a Service Operation builder has to be associated with an action list (the Action to Call parameter). Thus, we created the returnSupplies action list builder. This builder is one line of call to return, which is a variable that contains XML data. In a real-world application, the action list builder will be more involved and likely will invoke calls to a database or other data sources. You can also see from that figure that the service operation builder will not know how to handle the data that the operation returns unless it has a schema information, which is the role of the simple schema generator builder. The builder saves you from having to know how to create a schema. Instead, you simply provide sample data (the value of the suppliesData variable) to the builder, and it generates a valid schema structure for you.

Office service provider model summary


In summary, to create a service provider, you must have the service definition and the service operation builders. These builders create the underlying support for a service provider. When you create a builder using Web Experience Factory, the tool generates methods, variables, pages, Java code, and so forth that are necessary for the application to work. The generated code depends on the type of builder that you selected as well as the parameters you that you entered in the builder. To view the artifacts that are generated by Web Experience Factory, click the arrow icon that we show highlighted in the first figure of the Adding builders to the model section.

The figure below shows that the getSupplies service operation generates methods, data services, and variables (highlighted in blue). If you click one of the methods (for example, getSuppliesExecute), you can see the generated code to the right of the application tree.


Testing the Office Supplies Service Provider
Remember that you selected the option to add the testing support. It is very helpful to make this selection during the service provider's development process so that you can preview the operation's return before moving on to test the call from a service consumer.

Right-click on OfficeSuppliesProvider.model, and Run As --> Run active model.


The figure below demonstrates what is generated by the Web Experience Factory testing support of a service definition builder (a web page with the link to test the getSupplies operation). When you click the getSupplies link, you see the table that contains the product list as shown in this figure.


Next step
You have created the office supplies service provider model successfully. Now, you can create the blog provider as described in 10.3 Blogs service provider

Note: You can download the sample code from 10.6 The Office Supplies application sample code

Parent topic: 10.0 IBM Web Experience Factory


expanded Article information
collapsed Article information
Category:
IBM Redbooks: Customizing IBM Connections 3.0.1
Tags:
Redbooks

This Version: Version 5 November 22, 2011 3:54:29 PM by Stephen Smith  IBMer

expanded Attachments (0)
collapsed Attachments (0)

 


expanded Versions (5)
collapsed Versions (5)
Version Comparison     
Version Date Changed by               Summary of changes
This version (5) Nov 22, 2011 3:54:29 PM Stephen Smith  
4 Nov 21, 2011 4:14:51 PM Whei-Jen Chen  
3 Nov 21, 2011 2:22:00 PM Amanda J Bauman  
2 Nov 21, 2011 1:46:23 PM Amanda J Bauman  
1 Nov 21, 2011 1:46:10 PM Amanda J Bauman  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedSubscribe to RSSHelpAbout
  • All Lotus and WebSphere Portal wikis
  • IBM developerWorks
  • IBM Software support
  • IBM Social Business User Experience Blog
  • IBMSocialBizUX on Twitter
  • IBMSocialBizUX on Facebook
  • Lotus product forums
  • IBM Social Business UX blog
  • IBM Collaboration Solutions
  • Recently added feedRecently added
  • Recently edited feedRecently edited
  • Recently added comments feedRecently Added Comments
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Contact IBM
  • IBM Terms of use
  • Wiki terms of use