Developing composite business applications with Websphere Dynamic Process Edition

Websphere® Dynamic Process Edition enables business and technical users to work together to develop composite business applications. In this article, we'll walk through the detailed steps to create a composite business application, and give you some best practice recommendations and some tips to avoid common pitfalls. This content is part of the IBM Business Process Management Journal.

Share:

Belinda Chang (belchang@us.ibm.com), Staff Software Engineer, IBM

Belinda ChangBelinda Chang is a Software Engineer with the WebSphere Enablement Team for IBM Software Services for WebSphere, working on pre-sales engagements with a focus on the Business Process Management stack.



Ashok Iyengar (ashoki@us.ibm.com), Senior Software Engineer, IBM

Ashok Iyengar photoAshok Iyengar is a senior software engineer with the WebSphere Enablement Team of IBM Software Services for WebSphere based in San Diego, California. He works on pre-sales engagements focusing on business integration and portal. He is the author of WebSphere Business Integration Primer.



08 September 2010

Overview

With the introduction of WebSphere Business Services Fabric (hereafter called Fabric) widgets in Business Space, business users can now create artifacts for use in composite business applications. Business users can define business-level details and developers can then fill in the technical details. Many Fabric components can be defined in Business Space, and then used during the modeling and development phases. As in earlier releases, users can still create their projects in the Fabric administrative console and define everything in WebSphere Integration Developer Composition Studio, but this method doesn't leverage much of the new functionality available beginning in V6.2, and precludes participation from the business users. This article will focus on the new methodology for creating, deploying, and testing composite business applications, as shown in Figure 1.

Figure 1. Creating and deploying composite business applications with WebSphere Dynamic Process Edition
Creating and deploying composite business applications with WebSphere Dynamic Process Edition

With V6.2 and beyond, business users can define vocabulary, services, service variations, applications, and policies in Business Space. They can use widgets to browse the existing artifacts (created, for the most part, in Business Space, except for vocabulary which can be imported, if desired). From there, a business analyst can pull these artifacts into WebSphere Business Modeler (hereafter called Modeler) and model the process and the service variations. Once the model is complete, the integration developer can export the model into WebSphere Integration Developer (hereafter called Integration Developer). The developer can then associate the components with the Dynamic Assembler and with the composite services. He or she can define endpoints and add new assertions and policies (probably IT-specific policies). Finally, the developer can simulate the policies and unit test the application in the development environment.

With this new methodology, the question of where should changes be made arises? Where a change is made dictates which users can access and interact with the change. Changes made in Business Space should be relevant to business users and have business implications. Changes made in Business Space can be viewed by everyone, but developers cannot edit changes made by business users. On the other hand, changes made in Modeler and Integration Developer are not seen by business users. For instance, in Modeler, the business analyst can define new service variations and the developer can add new assertions and policies. Keep in mind, though, that any changes made at this level are not propagated up, so the business user is unaware of these changes and they won't be exposed in Business Space for the points-of-agility (PoA) widgets.

Service variations and policies should be created in Modeler and Integration Developer only for technical reasons. Service variations created in Modeler and Composition Studio should be equivalent in business function characteristics to those created in Business Space. The policy to select between these equivalent functioning services can be composed in Composition Studio but there should be no business reason why one variation would be chosen over another.

In this article, we'll walk through creating a composite business application that's able to enforce policies for hiring a new employee.


Define components and create the application in Business Space

Complete the following steps to define the vocabulary, create the services and variations, define the policies, and create the application in Business Space.

  1. Start the Fabric Test Server in Integration Developer and and open Business Space (the default location is http://localhost:9080/BusinessSpace).
  2. Create a business space based on the Fabric Business Services Authoring template. Using the Fabric Authoring template, business users can define many Fabric concepts such as vocabulary, services and policies.
  3. Start off by creating a vocabulary using the vocabulary widget. This widget allows business users to create a business vocabulary that the application and related services will use. This allows business users and IT to agree upon the channels, roles and business concepts. The business user can define the following in the vocabulary widget:
    • Channel: How users will interact with the process and services
    • Role: Who should access the services
    • Business concepts: Translates to your business object in Modeler and Integration Developer
    In the Vocabulary Browser page, click Actions. From the dropdown menu, select New Vocabulary and name the vocabulary Employee OnBoarding Vocabulary.
  4. Add Portal channel and create the following roles: New Hire Employee, Hiring Manager, HR Manager, 1st Level Manager, and 2nd Level Manager, as shown in Figure 2.
    Figure 2. Vocabulary details after creating the channels and roles
    Vocabulary details after creating the channels and roles
  5. Business concepts are analogous to business items in Modeler or business objects in Integration Developer. Add a new business concept called Hiring Advisory Business Variable, as shown in Figure 3. Set the type to Set of Fixed Values (Enumeration). An enumeration means that users will select the values for the business concept from a select set of values.
    Figure 3. Creating a new business concept
    Creating a new business concept
  6. Create another business concept named Job Offer that's a complex object.
  7. Now we need to provide enumeration details for the Hiring Advisory business variable. Enter the values for the Hiring variable, as shown in Figure 4: Elevated, Restricted, and Frozen. Make sure to save your changes as you go.
    Figure 4. Adding values to the enumeration
    Adding values to the enumeration
  8. Since the Job Offer is the business concept that we're concerned about, it is the source concept. Because a job offer contains a hiring exception, we'll add a has relationship to the Job Offer business concept. Select has from the dropdown menu. Give the relationship a name and set the cardinality, as shown in Figure 5. Since the job offer contains a hiring exception, set the hiringException business concept to be the target concept.
    Figure 5. Relationship details for a complex business concept
    Relationship details for a complex business concept
  9. Next we need to create business services. A business service is basically a business function that can be executed at runtime with adaptable behavior based on policies and context. In Business Space, users can define the inputs, the outputs, and context information. Business services have service variations that map to the various endpoints that can be used. The Dynamic assembler will choose the correct endpoint based on context. The endpoints can be defined in Business Space, Modeler or Integration Developer. As we discussed earlier, where you define the service variation is based upon the scope of the variation.

    Each business service can also have policies. Think of policies as "if-then" rules. If certain conditions are true, then the assertions (requirements, constraints) are applied. Business service policies are specific to the business service. With these policies, users can assign concepts or select service variations only.

    In the Business Service Browser page, click Actions => New Business Service and name the service Employee OnBoarding Business Service, then click OK.

  10. Select the new business server to open the Details page. Click Edit, then click Add next to Business Service Inputs and Outputs. For the input, enter Job Offer In as the variable name, and select Job Offer as the Type, as shown in Figure 6. For the output, add a variable named Job Offer Out, also with a type of Job Offer. Click the input type and change it to output, then click Save.
    Figure 6. Business service inputs and outputs
    Business service inputs and outputs
  11. A business process or service will take different paths based on the business policy. These paths are known as business service variations. Click Add next to Business Service Variations to create three new business variations, as shown in Figure 7. Name them Requires 1st Level Approval, Requires 2nd Level Approval, and Stop Hiring Process.
    Figure 7. Business Service details after creating the service variations
    Business Service details after creating service variations
  12. Now you can add the business policy that affects the business flow. At a minimum, policies are linked to a business service and have an effective date, an expiration date, a condition, and a result. Click Add next to Business Services Policies to create a new policy and name it Elevated Hire Policy. This policy will basically say that when the hiring condition is elevated, we need management approval before we can hire the employee.
  13. Now that you've created a business service policy, you need to add conditions to the policy. Click in the Effect Date field and select January 1, 2010. Click in the Expiration Date field and select March 31, 2010. Click under When to add a condition to create a condition for when the Hiring Advisory business variable is elevated, as shown in Figure 8. Set Field Name to Hiring Advisory Business Variable, Comparator to is equal to, and Value to Elevated.
    Figure 8. Creating a condition for a business service policy
    Creating a condition for a business service policy
  14. When the condition is met, we want to require management approval, so we want the Dynamic Assembler to select the Requires 1st Level Approval endpoint that we created earlier. Click under Then to add a result. Select Select a process variation. For Service Variation, select Requires 1st Level Approval, as shown in Figure 9. Repeat this step to create two more business service policies indicating that when the hiring advisory is restricted, the employee will need 2nd Level Management approval,and wen the hiring advisory is frozen, all hiring processes must be stopped.
    Figure 9. Creating a result for a business service policy
    Policy Result
  15. The final step is to create the business application. The business application is a logical collection of related business services. In Business Space, users assemble the business services into a logical flow. In the application Browser page, click Actions => New Application and name the application Employee OnBoarding.
  16. Select the new application to open the Details page. In the Details page, select the Application Flow and open it for editing.
  17. Click New to create a new flow and choose the channel (Portal) for the application, then click OK.
  18. You'll see a Portal input node, a service node, and a terminate node, as shown in Figure 10.
    Figure 10. Application flow
    Application Flow
  19. Click the square service node to add a new business service. In the pop-up dialog, select Employee OnBoarding Business Service.

Hints and tips for working with Business Space

Following are some suggestions for solving some common issues you may encounter when working with Business Space:

  • Why are many of the buttons grayed out buttons in Business Space?

    There are a lot of prerequisites before you can define other artifacts. We've learned that the best thing to do is work bottom-up. This way you'll have things defined when you need them.

  • Why don't I see the right attributes when creating a policy?

    Make sure that the service for which you are defining the policy has the right input defined. The attributes in the "if" condition of the policy are determined by the inputs of your business service.

  • Why can't I create a service?

    In previous versions of Fabric, a channel was not required. Business Space, however, requires a channel in order to create a service. If you find you can't create a service, make sure you have a channel defined.

  • I can't see the project artifacts from imported projects or other projects I know exist in the Fabric administrative console.

    Make sure you have been given the Business Space application authority to access the information through the Fabric administrative console.

Model the process in WebSphere Business Modeler

Upon completion of the Business Space steps, you need to incorporate the artifacts in a business process model. In Modeler, a business analyst can update the business processes. To do this, complete the following steps:

  1. Open Modeler or go to the Business Modeling perspective in Integration Developer. Right-click in the navigation pane and choose Import.
  2. Select the WebSphere Business Services Fabric repository elements to import, and click Next.
  3. Click Add Repository to configure a new Fabric repository, and add the repository that you just created the data in, as shown in Figure 11. This will be the Fabric test server in Integration Developer.
    Figure 11. Adding a new Fabric repository
    Adding a new Fabric repository
  4. When the Import wizard has populated the repository contents, select the Employee OnBoarding application that you want to import (notice that the other necessary projects are automatically selected), and click Finish.

    You'll notice that the three business service variations get imported as processes in the Employee OnBoarding business service folder.

    In general, the process in the application module will show the process flow as created in the application widget in Business Space. Each of the services is its own module and the service variations for each service are empty process templates ready to be modeled. The business concepts are in the vocabulary module as business items and the roles are also in the vocabulary module as resources.

  5. Double-click the Requires 1st Level Approval process to edit it. Add a Task node and wire it to an input and output of Job Offer as shown, in Figure 12. You may choose to add other modeling artifacts. Save the flow (Ctrl+S).
    Figure 12. Finish modeling
    Finish modeling
  6. In the same way, add a Task node to the other two processes: Requires 2nd Level Approval and Stop Hiring Process.

After finishing all desired modeling, you need to export the application artifacts to Integration Developer.


Assemble the solution with WebSphere Integration Developer

Using Integration Developer, you (as the integration developer) can now assemble the solution. You can make the necessary associations between the business services and contexts, add details to implement the processes, and unit test the solution. You can perform simulations on policies in Composition Studio. However, if you discover errors with the policies, you would need to have the business user modify the policy. Remember that integration developers can view and work with the policies but cannot edit them in Integration Developer. Policies created in Business Space can only be edited there. This provides separation of concerns because the technical implementer will not modify what the business user created.

  1. Right-click the Employee Onboarding application in the navigation pane, and select Export.
  2. Once the project has been imported into Integration Developer, go to the Business Integration perspective and open every single assembly diagram associated with the project before you import them into Composition Studio (the Business Service perspective).
    Figure 13. Assembly Diagram view after initial import
    Assembly Diagram view after initial import
  3. Web service binding vs. SCA binding

    Choosing a web service binding versus an SCA binding really depends on whether you want policy propagation or not. If you want to do policy propagation, you have to use an SCA binding. If not, you can use a web service binding.

    If necessary, generate a web service binding for each and every export in the assembly diagrams. For example, in the EmployeeOnBoarding assembly diagram, right-click the EmployeeOnBoarding export, and select Generate Binding => Web Service Binding.
  4. In the Business Service perspective navigation pane, right-click to create a new Fabric project and name it EmployeeOnBoarding. Provide the HTTP port number and click Configure to connect to the Fabric repository (this may take awhile).
  5. Once the replication is complete, click Next, then select the modeled Fabric application Employee OnBoarding, as shown in Figure 14.
    Figure 14. Business Services view after creating Fabric project
    usiness Services view after creating Fabric project
  6. The first thing we want to do is create a composite service. Right-click the newly created EmployeeOnBoarding project, then select New => Composite Service. The namespace should be Employee OnBoarding (Technical). Choose the SCA project called EmployeeOnBoarding1 and click Finish.
  7. After the composite service is created, the editor is displayed. Go to the business application and check Maps to a Business Application Module, then click Browse and select the Employee OnBoarding pplication. This is how you associate the composite service with the application.
  8. In the same fashion, create a new composite service for the SCA project EmployeeOnBoardingBusinessService1. In the Business Service Mapping section, as shown in Figure 15, click Browse and choose the Employee OnBoarding business service. In the Channel Mapping section, click Browse for each Export component and choose the related channel (Portal, in this case). This is how you associate the channel with each Export component in the application. Make sure to save your changes.
    Figure 15. Composite service view
    Composite service view
  9. Now you need to create a context specification. Right-click the new EmployeeOnBoarding project and select New => Context Specification. Set the project to EmployeeOnBoarding, the name to EmployeeOnBoarding Context, and the namespace to Employee OnBoarding (Technical).
  10. Double-click on the new EmployeeOnBoarding Context to edit it. Go to the Dimensions tab and scroll to the Vocabulary Dimensions section. Click Add to add a new vocabulary dimension and add the Hiring Advisory Business Variable, as shown in Figure 16.
    Figure 16. Context specification details
    Context specification details
  11. You need to associate the context specification with a dynamic assembly component. To do this, open the composite service editor for EmployeeOnBoardingBusinessService1 and go to the Components tab. Double-click on the Employee OnBoarding Business Service component. In the Dynamic Assembly Component section, click Browse next to Context Specification and select EmployeeOnBoarding context.
    Figure 17. Dynamic assembly component details
    Dynamic assembly component details
  12. We need to let Fabric know that a certain endpoint is actually one of the business service variations. To do that, double-click the Requires 1st Level Approval endpoint. Go to the Assertions tab, and click Add. In the Process Variation Assertion window, choose the variation that matches the selected endpoint, and click OK.
  13. In the same manner, create corresponding process variation assertions for the other two endpoints: Requires 2nd Level Approval and Stop Hiring Process.
  14. You need to add a context extractor for each dynamic assembly component that has a context specification. To do this, switch to the Business Integration perspective and edit the EmployeeOnBoardingBusinessService1 Assembly Diagram. For V7, add a mediation to the canvas. Wire the export to the mediation and wire the mediation to theEmployeeOnBoardingBusiness Service dynamic assembly component. When you wire the mediation, you might get warnings about creating matching interfaces. You can ignore these warnings.
  15. Right-click on the mediation and select Generate implementation. In the mediation flow editor, double-click on the service and select Create a blank mediation flow.
  16. Click the Request tab. Add a callout and a context extractor mediation to the palette. As shown in Figure 18, click on the output terminal of the EmployeeOnBoardingBusinessSerivce input node and wire it to the input of the context extractor. Click on the output terminal of the context extractor mediation and wire it to the input of the EmployeeBusinessService callout. You also need to wire the input and callout terminals of the response.
    Figure 18. Wire request
    Wire request
  17. Click on the response tab and wire the output terminal of the EmployeeOnBoardingBusinessService callout response to the input of the EmployeeOnBoardingBusinessService input response node, as shown in Figure 19.
    Figure 19. Wire response
    Wire response
  18. Once you've finished all the wiring, click the Request tab again, and double-click the context extractor mediation to view the properties. On the Details tab of the Properties view, click Add to add a context mapping. Select the context key (or the vocabulary that was defined in Business Space), as shown in Figure 20. Select the value that you want to set the context key to (the value from the business object), then save all your changes.
    Figure 20. Context extractor mediation properties
    Context extractor mediation properties
  19. For V6.2, add a Java™ component to the canvas. Name it EOBContextExtractor. Right-click the EOBContextExtractor component and select the Add interface icon.
  20. In the Add Interface window, filter by ContextExtractor, and select Show Java, as shown in Figure 21. You should see a couple of qualifiers. Choose the one that has "fabric" in the name, and click OK.
    Figure 21. Add interface to context extractor
    Add interface to context extractor
  21. Wire the EmployeeOnBoardingBusinessService dynamic assembly component and the EOBContextExtractor Java component, then click OK to add a matching reference and interface. Click No if prompted whether you want to add the Fabric JARs. We'll add all the required Fabric-related JARs to the Java build path later. Save your changes.
  22. To add the Fabric JARs to the project,open the project properties and add Fabric Server Library to the Java Build Path, then click OK.
  23. Open the assembly diagram for EmployeeOnBoardingBusinessService1. Double-click on the EOBContextExtractor Java component to implement it. You may also add the implementation to the default package if you choose. We already added it to the processes.employeeonboardingbusinessservice package. Edit the context extractor to set the selection property, keeping in mind that the ID value for the concept may vary.
    Listing 1. Sample code listing
    public Context extractContext(PendingRequest arg0) throws 
    UnexpectedContentException {
    	Context ctx = arg0.getContext();
    	String theXpathHireException = 
                        SdoXPathUtil.getFullXpath(arg0.getFirstBodyElement(),
     "/hiringException");
    	
    	XPathSearchResult<String> xpathValueHireException = 
    		SdoXPathUtil.getViaXpath( arg0.getFirstBodyElement(),
    				theXpathHireException );
    	
    	String xHireException = xpathValueHireException.getValue();
    	ctx.setSelectionProperty
    	("fc://business/enumconcept#u37ad281a-2001-4a2a-ac24-cc2d68e33eaf",
    	new TypedValue(xHireException));
    
    	return ctx;
    
    }
  24. Deploy the Fabric applications to the Fabric server.
  25. One of the easiest ways to test things is to test the dynamic assembly component in the assembly diagram.Specify either Elevated, Restricted, or Frozen as the hiringException value. If all is working as expected, you should see the corresponding endpoint being invoked.

Hints and tips for working with WebSphere Integration Developer

Following are some general recommendations and tips for working with Integration Developer:

  • Always make sure that you've committed and updated your Composition Studio project. You may also need to go into the Fabric administrative console's governance widget to publish the changes.
  • Each service must be assigned a channel. No errors will be displayed until runtime. Make sure that channels are assigned in the Channel Mapping section of the Composite Service browser.
  • Delete the endpoint of the dynamic assembly component discovered when you create the composite service. This won't cause any problems but is considered a best practice.
  • If the endpoints are not imported when you create the composite service, create them manually.
  • If the dynamic assembly component doesn't show up when you create the composite service, it's likely your project has been corrupted. Make sure you backup your OWL files before you do too much in Integration Developer and continue to back up those files regularly!
  • When you share projects, don't import or export your Composition Studio project. As a best practice, pre-pend Composition Studio project names with Fabric so you know not to select them when exporting projects.

Following are some hints for dealing with some common issues you may encounter when working with Integration Developer:

  • Why don't I see created vocabulary in the Assertions Explorer tab?

    Try deleting your old Studio project and creating a new one. If you happen to see two projects with the same name, try to select the other project instead. Otherwise try the following steps:

    1. Log into the Fabric administrative console: http://{server}:{port}/fabric
    2. Select Governance Manager => Configure Projects.
    3. Seleect the project that you're trying to use in Composition Studio (This should be a project of the type Composite Business Application).
    4. Go to the Namespaces tab and select Import Namespace
    5. Select either Fabric Business Glossary (for V6.2) or Business Glossary (for V7) in the dropdown menu, then check the vocabularies you want to be able to view, and select Import Namespaces.
    6. In Composition Studio, update the project by right-clicking on the project in the Repository Changes view and selecting Update Project.
    You can also access the vocabulary by clicking on the provided URL after you've added the vocabulary to your context.
  • Why can't I can't view the vocabulary in the mediation?

    Make sure you have a FabricAdministrators group and that you are a member of the group. Also make sure to update the vocabulary if you have made changes.

  • Why do I see the following error: "Missing Context Dimensions Error: com.ibm.ws.fabric.da.impl.MissingContextException: Required Context Dimensions have not been supplied. The required dimensions are [fc://business/enumconcept#u37ad281a-2001-4a2a-ac24-cc2d68e33eaf]" ?

    Check the following:

    • Make sure that the right interface (from the Fabric ContextExtractor class) is being used.
    • Make sure that the context extractor is attached to the correct Dynamic Assembler.
    • Double check your IDs.
    • Put in a print statement to see if the extractor is even getting called at all, or make sure your mediation isn't failing.

Tips for sharing projects

Following are some good ideas for sharing projects:

  • When you export your projects, make sure that if you touched things in Business Space, you export your vocabulary as well. By default your vocabulary namespace is in the Fabric Glossary project. Make sure to select all of your namespaces when exporting!
  • There's nothing to stop users from creating projects with the same name. This may be problematic when more than one user is on the same server. When users try to export a project in Fabric, there is no apparent sorting to distinguish between the projects. To solve this, you can delete the older irrelevant project. In some cases, you may need to export both projects and examine the OWL files to determine which project they require.
  • When importing your project, import the vocabulary first! Otherwise, you may see reference errors. There may also be other dependencies between the projects so make sure you understand all dependencies before importing in your projects.
  • If you imported a project from the administrative console, you need to remember to enable access in Business Space through the Fabric authoring template if you want to be able make edits there.
  • Before you can delete a project, you must remove all the artifacts that reference the project. Remove any imported namespaces and delete the project's namespaces first.
  • Back up your OWL files before you do anything in Composition Studio. Back up those OWL files regularly. If something gets corrupted, it's better to have a backup of what changes were made to Fabric as well.
  • Order matters when importing in projects!

Conclusion

This article has walked you through the steps to create a business composite application starting from Business Space. With many of the new widgets in Business Space, business users can now participate in the process for creating business applications such as defining the business services, vocabulary and policies in Fabric. You've also learned how the business artifacts can be imported into Modeler and Integration Developer so they can be enhanced and deplpyed by the integration developer. In addition, we shared some tips that might help you avoid or fix common roadblocks during the design and development process.

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=517167
ArticleTitle=Developing composite business applications with Websphere Dynamic Process Edition
publish-date=09082010