Novell exteNd 5 Guided Tour

LESSON 3

Deploying and Testing the Web Service

 
Top of page

About this lesson

 
Top of section

Objective

The exteNd Composer project you just worked in Lesson 2 is part of an exteNd Director project. exteNd Composer is being used as the data layer of the application, and exteNd Director will be used for the presentation layer. Through cleanly separating the two layers, changes may be made to one without necessarily requiring changes in the other.

In this lesson you are going to create a service trigger for the exteNd Composer service you completed, deploy the application, then use exteNd Composer to test the SOAP interface to the service.

 
Top of section

What you will do

  1. Start exteNd Director and open the project

  2. Create a SOAP-based service trigger

  3. Sidebar: the exteNd Director development environment

  4. Deploy the application

  5. Test the Web Service using exteNd Composer

 
Top of section

EXERCISE 3-1: Start exteNd Director and open the project

In the interest of time, you will use a template project that has some of the artifacts you need already completed, including the addition of the exteNd Composer project. In 4, Completing the exteNd Director Project, you will be reviewing some of these artifacts. When you have completed the required artifacts, you will test the completed application.

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

    StartPrograms DirectorDesigner

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

  3. Navigate to the project folder by clicking on the Look in dropdown list. The project folder is D:\GuidedTour\template\RequestUserInfoProject:

    FileDialogLookinList

  4. Select the project file RequestUserInfo.spf, then click Open:

    DirectorOpenProjectDialog

  5. Change the view DirectorViewUsingArchive in the Navigation Pane to the archive layout view.

    What you see in archive layout view    This view is a structural view of the archive that will be deployed to the server. It shows you where the various artifacts in your project will be placed in the archive. The default view is source layout, which shows you where the artifacts are actually stored in the development file system. In J2EE, where things are placed in the archive is important.

    All the artifacts of the exteNd Composer and exteNd Director projects are stored as files in folders located relative to the project file you opened.

    The resource set    One of the features of exteNd Director that helps cut down on the amount of developer time required in testing—by reducing the number of deployments required—is the resource set. (For more details on the resource set, see the chapter on using the resource set in an exteNd Director application in Developing exteNd Director Applications.)

    An exteNd Director project has a configuration file called resourceset.xml, and for the resource set to be used properly in exteNd Director and the exteNd Application Server (or any other application server), a variable in the file must point to the project's physical location on your drive.

    Now you will adjust this variable, because the current location of your project is most likely different from the location used to create the project initially.

  6. In the Folder Pane of the Navigation Pane, click the expandIcon icon next to the WEB-INF folder.

  7. Select the conf folder.

  8. Double-click the resourceset.xml file in the Detail Pane of the Navigation Pane to open the file in the Editor Pane:

    DirectorResourcesset xml editor

  9. In the Editor Pane, click the Variables tab.

  10. Locate the WARLOCATION key and change its Value to point to the physical location where you placed the template project—for example: D:\GuidedTour\template\RequestUserInfoProject.

    DirectorResourcesset xml WARLOCATION

  11. Press Enter to save the change:

  12. Click the FileSaveToolbarIcon toolbar icon to save your changes.

  13. In the Editor pane, click the General tab.

  14. Scroll down until you see the Restart button. Click the Restart button.

    ResourcesetGeneralButtons

  15. Close the open editor by clicking DirectorEditor CloseIcon the editor title tab DirectorEditor NameTab.

 
Top of section

EXERCISE 3-2: Create a SOAP-based service trigger

An exteNd Composer service requires a Java service trigger that will interact with the exteNd Composer runtime on behalf of the users of the service.The exteNd Composer service you completed will be invoked as a Web Service using SOAP.

For working with Web Services, you need to have a Java servlet that is listening at the URL specified when you created the WSDL (you did this in EXERCISE 2-9: Create the Web Services Definition Language (WSDL)).

In this exercise, you are going to configure a generic servlet, provided by exteNd Composer, to listen at your specified URL.

  1. Click the New File icon NewFileIcon.

  2. Select the Web Services tab.

  3. Select the Composer Web Service Wizard:

    DirectorWebServicesWizardTab

  4. Click OK.

  5. Select Web Service as the Service Trigger Types.

  6. Verify that RequestUserInfo is the target project:

    DirectorWebServicesWizard Dialog1

  7. Click Next.

  8. Verify that UserInfo is the project selected.

  9. Select ViewUserInfo as the service:

    DirectorWebServicesWizard Dialog2

  10. Verify that ViewUserInfo is selected as the WSDL in the Web Service Details block. Click Next.

  11. Accept the defaults:

    DirectorWebServicesWizard Dialog3

  12. Click Finish.

  13. Click OK for the Composer Deployment Wizard confirmation dialog.

    DirectorWebServicesWizard Dialog4

 
Top of section

EXERCISE 3-3: Sidebar: the exteNd Director development environment

The exteNd Director development environment, along with providing you with the ability to visually create exteNd Director artifacts such as portlets and XForms, is also used to keep track of the J2EE-specific artifacts and to build and deploy the J2EE archives that make up your project. In this exercise you will take a slight detour to look at some of the features of exteNd Director that are useful in managing the development of a Web-based solution.

In the last exercise, when you created an exteNd Composer service trigger, you may have noticed that no source file was opened. So you may wonder whether you actually have a service trigger or not.

The answer is yes—the exteNd Composer runtime provides a servlet implementation that accepts the SOAP request, invokes the exteNd Composer service, and formats a SOAP response. This servlet is configured to invoke the correct exteNd Composer service by setting initialization parameters in the web.xml (J2EE Web application descriptor) file of the Web archive. Now you will view these entries.

  1. Scroll up the Folder Pane of the Navigation Pane until you see the RequestUserInfo.spf entry for the project, then select it.

    DirectorNavigation RequesUserInfo Selected

  2. Right-click to open the Context menu, then select Open Deployment Descriptor.

  3. If you get the Select Build Option dialog and do not want to see this dialog again, select No, don't build now, Never automatically build my project—then click OK:

  4. In the Editor Pane, scroll down until you see an entry called com.novell.composer.userinfo.ViewUserInfoSoapService. This is the servlet configuration.

    WebXML ComposerServiceEntry

  5. Close the open editor by clicking on the editor title tab.

For each type of application server, the exteNd Director development environment uses a separate server profile, which defines the details required for deploying to that type of application server. In this Guided Tour you are using the default profile, which will deploy to an exteNd Application Server running locally on your computer. If you want to review this profile or create a new one, use the profile editor available from Tools>Profiles:

DirectorProfilesEditor

 
Top of section

EXERCISE 3-4: Deploy the application

Now you are ready to deploy the application to the exteNd Application Server so that you can test the exteNd Composer service as a Web Service.

  1. Scroll up the Folder Pane of the Navigation Pane until you see the RequestUserInfo.spf entry for the project, then select it:

    DirectorNavigation RequesUserInfo Selected

  2. Right-click to open the context menu, then select Open Deployment Plan.

    The deployment plan defines the server-specific details necessary for successfully deploying the application to the exteNd Application Server. It is created and maintained based on the information in the web.xml descriptor file. You should always review and save the deployment plan before doing a deployment.

    TIP:   If you are deploying to a different server, you will need to change the server profile used by this plan.

  3. Click the FileSaveToolbarIcon toolbar icon to save your changes.

  4. Close the open editor by clicking the DirectorEditor CloseIcon on the editor title tab.

  5. Click the Deploy toolbar icon DirectorToolbar DeployIcon.

When you see Deployment completed successfully in the Output Pane of the exteNd Director development environment, your deployment has completed.

This first deployment took a little bit longer than is usual, because not only was your application deployed to the server and then started by the server—but the database was also initialized. This was the database you created and defined a connection pool for in EXERCISE 1-4: Create a JDBC connection pool.

DirectorDesignerOutputPanel

 
Top of section

EXERCISE 3-5: Test the Web Service using exteNd Composer

In the exteNd Composer project there is a service (TestViewUserInfo) that was created to test the deployed ViewUserInfo as a SOAP service. This service has one action (the WS Interchange) that is used by exteNd Composer to consume a Web Service that uses SOAP binding. In this exercise you will use this service to test the application you just deployed.

Set the log threshold

As part of your testing you want to see the output from the Log actions in the Composer Component and Service to appear on the server console. For this to happen you need to set the log threshold on the server using the Composer Administrator Console.

  1. Open your favorite browser.

  2. In the address bar, type http://localhost/exteNdComposer/ and press Enter.

  3. Type the exteNd Application Server administrator user ID and password you supplied when you installed the exteNd 5 Suite, then click OK:

    ComposerAdminConsole

  4. Change the Log Level to 4, then click Apply Log Level.

  5. Close the browser application by using File>Close.

Test the Web Service

  1. Open the exteNd Composer Designer. (It should still be open, and using Alt+Tab should get you to it.)

  2. In the Category Pane of the Navigation Pane, select Web Service under the Service category.

  3. Double-click TestViewUserInfo to open the service in the Editor Pane.

    Composer TestService Opened

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

  5. Click OK on the Execution Completed dialog. You should see results returned by the SOAP service in the Output DOM of the editor.

    Composer TestService Executed

    When you look at the server console, you will see the log results from the exteNd Composer runtime:

    ServerConsoleComposerLog

    Congratulations. You have successfully completed an exteNd Composer service and deployed it with a SOAP service trigger.

  6. Close the exteNd Composer Designer application by using File>Exit. You will not need exteNd Composer for the remainder of this Guided Tour.

  7. When prompted to confirm closing exteNd Composer, click Yes.

Next lesson   In the next lesson you will complete an exteNd Director portal application that allows end users to consume the service.



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