Novell exteNd 5 Guided Tour

LESSON 2

Completing the exteNd Composer Project

 
Top of page

About this lesson

 
Top of section

What is exteNd Composer?

Novell exteNd Composer is a development (and runtime) environment for the rapid design and deployment of Web Services and XML integration to applications—applications that can connect to diverse back-end (legacy) systems and data sources. exteNd Composer offers a flexible, intuitive, point-and-click GUI (graphical user interface), giving the business analyst or application developer a powerful tool for creating robust XML integration solutions in minimum time.

 
Top of section

Objective

This project provides an exteNd Composer component that extracts information from an LDAP directory. The component (using the LDAP Connect) provides basic user information such as name, phone, and title. In this lesson you will complete the application by completing an exteNd Composer service for later deployment as a Web Service. The Web Service will receive a request with a user ID and provide the information supplied by the component.

 
Top of section

What you will do

  1. Start exteNd Composer and open the project

  2. Review the LDAP component

  3. Sidebar: the exteNd Composer Component Editor Layout

  4. View the input and output documents for the LDAP component

  5. View the LDAP connection resource

  6. Review the Action Model

  7. Test the component

  8. Complete the Action Model for the service

  9. Create the Web Services Definition Language (WSDL)

 
Top of section

EXERCISE 2-1: Start exteNd Composer and open the project

  1. Start exteNd Composer by going to the Start>Programs>Novell exteNd 5.2>Composer menu and selecting Composer Designer.

    StartPrograms ComposerDesigner

    In the interest of time, you will use a template project that has some of the artifacts you need already coded. You will review some of the artifacts and complete the steps required to finish this part of the application.

  2. Open the project by selecting menu File>Open Project.

    ComposerOpenProjectDialog

  3. Navigate to the project folder by clicking the Browse button. The project folder is: D:\GuidedTour\template\RequestUserInfoProject\UserInfoProject.

    ComposerSelectProjectFileDialog

  4. Select the project file UserInfo.spf and click OK.

  5. Click OK.

 
Top of section

EXERCISE 2-2: Review the LDAP component

In this exercise you will review the component that retrieves the information from the exteNd LDAP server. This component was created using exteNd Composer LDAP Connect.

  1. In the Category Pane of the Navigation Pane, select Component and then LDAP.

    ComposerLDAP ComponentCategory

  2. In the Detail Pane of the Navigation Pane, double-click RequestUserInfo. This opens the component in the Editor Pane.

    LDAP ComponentOpenInEditorPanel

 
Top of section

EXERCISE 2-3: Sidebar: the exteNd Composer Component Editor Layout

Now you will take a look at the exteNd Composer functionality that allows you to quickly build and test solutions that access legacy data sources.

Step 2 of the previous exercise shows the exteNd Composer Designer with an LDAP Component open in the Editor panel. The Editor Pane is divided into three subpanes:

 
Top of section

EXERCISE 2-4: View the input and output documents for the LDAP component

The Input XML document is an XML template containing a sample of the data required to make a request for user information. You use this template as a guide for writing the Action Model and testing the execution of the model.

Composer XML InputSample

The Output XML document is also an XML template. It contains a sample of the data that will be provided to fulfill the request.

Composer XML OutputSample

The sample of the Output XML is what is sent if the component is successful in connecting to the directory and finding the requested user information. If the user does not exist, an error message is sent. You will now view the sample data and the XML structure in the Output XML document.

  1. In the Output XML document in the Component Editor, right-click to open the context menu.

    Composer XML DOM ContextMenu

  2. Select Load XML Sample.

  3. Click the Sample dropdown list then select UserInfoResponse_message.xml.

    ComposerLoad XML SampleDialog

  4. Click OK.

    Composer XML OutputSample Message

 
Top of section

EXERCISE 2-5: View the LDAP connection resource

The LDAP component requires a connection resource to connect to an LDAP server. The connection resource provides the specific information required to establish a connection to the exteNd LDAP directory server you are using. Now you will view the resource used by this component.

  1. From the menu bar select File>Properties.

  2. Select the Connection Info tab.

    ComposerConnectionTab

    The Connection Info tab provides the information for the connection resource being used in a read-only mode. By clicking the Test button you can verify that a connection to the exteNd LDAP server can be established. Note the icon next to some of the field values: this indicates that an ECMAScript expression is used to create the required value. The actual values are stored as project variables in your project, where you can easily change them in one place or even dynamically before the component is executed.

  3. Click OK to close the dialog.

 
Top of section

EXERCISE 2-6: Review the Action Model

The Action Model is the collection of instructions that are executed in sequence to process the input to produce the output. In this exercise you will review some of the key actions in the LDAP component that will be executed by the Web Service you are going to complete.

ComposerEditor ActionModel Panel

Log actions

The first, third, and fifth actions are Log actions used to report debug-level information. This logging can be turned on by setting exteNd Composer's Designer or Server Log threshold. After deployment to an application server, these Log actions may be helpful in tracking down problems with a deployed application. It is good development practice to be proactive about adding them to your code. If you want to see the results of the debug Log actions in this project, you must set the Log Threshold in the Preferences to 4 or lower.

LogAction

Create DSML Search Request action

The second action is a Create DSML Search Request action, used to create an LDAP request as a DSML XML document. This action creates the actual query details (the where clause) and identifies the attributes that are to be returned.

CreateDSML Action

When you select this action, the Native Environment Pane allows you to review and edit the details of the search request. The UserID in the Input XML Document is used to query the uid attribute in the directory.

DSML ActionNativePanel

The result of executing this action is an XML document that is placed in a temporary XML DOM.

Now you will view this document in the XML Documents panel.

  1. Right-click in the XML Document panel, select the Add to Display submenu, and select ldapRequest. This is the temporary XML DOM used to hold the XML created by the Create DSML Action.

    DSML Request XML empty

  2. In the Action Model, select the Create DSML Search action.

    CreateDSML Action selected

  3. Click the Execute Current Action icon ExecuteActionIcon on the toolbar. This executes the action and displays the XML created for the request in the XML Document panel.

    DSML Request XML full

  4. Now click the Execute All icon ExecuteAllIcon on the toolbar. This causes the entire component to be executed, providing you the results of a successful query.

  5. Click OK at the Execution Completed message dialog.

Execute DSML Request action

The fourth action is an Execute DSML Request action. This action takes the request created by the Create DSML Search Request action and connects to the server to execute the request. The result is placed into another temporary XML document called ldapResponse.

ExecuteDSML Action

Here is what the Native Environment Pane looks like when the action is selected, after execution:

DSML ActionNativePanel Execute

Here is the ldapResponse XML document.

DSML Response XML full

Decision action

The sixth action is a Decision (IF) action. This action checks for a successful request. If the request is successful, the TRUE block of actions will be executed. This sequence of actions is used to produce the required output you saw in the Output XML Document earlier.

First the XML document is created with no data to ensure that the structure of the XML document conforms to the schema. exteNd Composer will always create well-formed XML, but it is your responsibility to ensure that the XML is valid when an XML Schema or DTD is specified.

ActionModel SuccessBuild XML

The next step is to handle each of the attributes returned in the result and place the data in the XML document. The DSML response will contain a repeating element for each of the attributes that was requested and is available for that specific entry in the directory. The Action Model must loop through each of these repeating elements and check the attribute name, placing the value into the correct element in the output XML document.

ActionModel CheckAttributeAddValue

The FALSE blocks of the Decision actions contain Map actions that create message structures used in the event of failure, and a Log action used to log the failure of an LDAP request.

ActionModel FalseBlocks

Apply Namespace action

The final action is an Apply Namespace action that adds a reference to the XML Schema namespace that can be used to validate this document.

ActionModel NamespaceAction

 
Top of section

EXERCISE 2-7: Test the component

With the exteNd Composer Designer, you can test the execution of the component without having to deploy to a J2EE application server. You will now test the component—first with a valid user ID and then with an invalid ID.

  1. The valid user ID is already provided for in the default XML Input sample. Click the Execute All icon ExecuteAllIcon on the toolbar.

  2. Click OK for the Execution Completed message dialog.

  3. Review the Output XML Document.

    OutputValidUser

  4. To enter an invalid User ID you need to change the Input sample. Double-click the value SSpade.

    ChangeInputData

  5. Type xxx replacing SSpade.

  6. Click OK.

  7. Click the Execute All icon ExecuteAllIcon on the toolbar.

  8. Click OK for the Execution Completed message dialog.

  9. Review the Output XML Document.

    OutputInvalidUser

    You have now finished reviewing the LDAP component. To close the LDAP component:

  10. Click on the Close icon in the editor to close the component.

    CloseDocumentFrameIcon

  11. If prompted to save changes, Click No.

 
Top of section

EXERCISE 2-8: Complete the Action Model for the service

With exteNd Composer, a service is required to act as the interface to the outside world. An application that uses the LDAP component you reviewed must invoke a service through a Service Trigger (more on this later) that will execute the component or even possibly other components. A service has its own Action Model. In this exercise you will complete the service that accepts the requested user ID and returns the information supplied by the RequestUserInfo component.

  1. In the Category Pane of the Navigation Pane, select Service and then Web Service.

    ComposerServiceCategory

    Although the service you selected is classified as a Web Service, it does not necessarily mean that it has a WSDL and SOAP binding. It is a Web Service only in the sense that it will normally be invoked as part of a Web application and that it responds to the request/response model used with HTTP.

    The service trigger (or triggers) for invoking the service are created when it is deployed to a J2EE application server (like the Novell exteNd Application Server). One of the deployment options available to you is to use a Web Service with a WSDL and SOAP binding.

  2. In the Detail Pane of the Navigation Pane, double-click ViewUserInfo. This opens the service in the Editor Pane.

    ComposerEditor Service

    Note that the XML Output sample used for the service is the message response. This was set as the default because the service will normally take the output produced by the LDAP component as its output. But in the event that the component fails to execute for any reason, the service will respond with a message.

    ComposerServiceOutputMessage

    The Action Model for the service has been partially completed for you. The Try On Fault action is a wrapper for the execution of the component; if it fails, the Fault section will be executed and a Log action will send a log message to the System Output. You will add the action to execute the RequestUserInfo component and a Map action to create the XML output in the event of a fault.

    ComposerServiceActionModel start

  3. Select the EXECUTE in the TRY action.

  4. Right-click to display the context menu. Then select New Action>Component.

  5. In the Component dialog, enter the following:

    ComposerServiceActionModel AddComponentAction

  6. Click OK.

    ComposerServiceActionModel step1

  7. Select All other Faults of the Try/On Fault action.

  8. Right-click to display the context menu. Then select New Action>Map (or use the keyboard shortcut Ctrl+M).

    ComposerServiceActionModel AddMapAction

  9. In the Source area click the Expression radio button, then click the ECMA Expression icon ExpressionEditor expression icon to open the expression editor.

    ExpressionEditor expression

  10. Type the following (include the quotes):

      "Error in component " + _SystemFault.XPath("m:FaultInfo/m:ComponentName") + " at " + _SystemFault.XPath("m:FaultInfo/m:DateTime") + " with MainCode " + _SystemFault.XPath("m:FaultInfo/m:MainCode") + ", SubCode " + _SystemFault.XPath("m:FaultInfo/m:SubCode")  + ", and with a message of " + _SystemFault.XPath("m:FaultInfo/m:Message") + "."
    

    _SystemFault is a Composer DOM variable that holds an XML document in the event that a system fault occurs. If you had forced a fault during the execution of the service (by stopping your exteNd LDAP server, for example), you could view the structure of this document in the expression editor. You would do this by clicking the icon next to _SystemFault.

    When you double-click an XML element in a DOM variable such as _SystemFault, the expression editor writes the appropriate ECMAScript expression—for example: _SystemFault.XPath("FaultInfo/DateTime").

  11. Click OK.

  12. In the Target text box, type UserInfoResponse/Message (or use the expression editor by clicking the icon.

    ComposerServiceActionModel step2

  13. Click OK.

  14. To place the Map action after the Comment action, you can drag and drop. Left-click the Map Action, hold it and drag it down to the Comment Action. Then release the left mouse button.

    ComposerServiceActionModel final

  15. Click the Execute All icon ExecuteAllIcon on the toolbar.

  16. Click OK for the Execution Completed message dialog.

  17. Review the Output XML Document.

    OutputValidUser

  18. Click the Close icon in the editor to close the service.

    CloseDocumentFrameIcon

  19. If prompted to save changes, click Yes.

 
Top of section

EXERCISE 2-9: Create the Web Services Definition Language (WSDL)

Now that the service is completed and tested, your next task is to create a WSDL for the service. You need to do this because you will be deploying this service as a Web Service, and the WSDL is required for the service trigger that will be generated. The WSDL will also be used to help build the user interface for the application in Lesson 4.

  1. In the Category Pane of the Navigation Pane, select Resource and then WSDL.

    ComposerResourceCategory

  2. Right-click to display the context menu, then select New.

    CreateNewWSDL forServiceResourceDialog 1

  3. Select the Create using Composer Editor radio button.

  4. Type ViewUserInfo in the Name text box.

  5. Type Describes the Web Services descriptor for the LDAP user information request service in the Description text box.

    CreateNewWSDL forServiceResourceDialog 2

  6. Click Next.

    CreateNewWSDL forServiceResourceDialog 3

  7. Select ViewUserInfo from the Service dropdown list.

  8. Select the Generate SOAP Service check box.

  9. Type http://localhost:80/RequestUserInfo/viewOnly in the URL text box.

    CreateNewWSDL forServiceResourceDialog 4

  10. Click Finish.

  11. If prompted with a message, click OK.

  12. Click the Close document frame icon in the editor to close the WSDL.

    CloseDocumentFrameIcon

You have now finished creating the exteNd Composer Web Service.

Next lesson   In the next lesson you will create a service trigger for the service, then deploy and test the service.



Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.  more ...