• No results found

Includes a simple tutorial to introduce you to service mediation in TIBCO ActiveMatrix.

In this chapter, you’ll:

• Create and configure a mediation component and mediation flow diagram

• Create and configure a SOAP service and a JMS reference

• Package the service, components, and

implementation artifacts into a service assembly

• Upload the service assembly to the environment, map service units to nodes, and map shared resource profiles to a shared resource

• Deploy and start the service assembly

• Invoke a SOAP service from a client Chapter 4, Setting up

and Starting ActiveMatrix Administrator and Runtime

Describes how to configure and start the

infrastructure and administration environment that is required to run the example in Chapter 3.

Because the environment requires some overhead that might slow the design environment, follow the example in Chapter 3 until instructed to perform the procedures described in this chapter.

In this chapter, you’ll:

• Start TIBCO and TIBCO ActiveMatrix infrastructure servers

• Set up and start the ActiveMatrix runtime environment, including an ActiveMatrix node

Where to Find More Information

|

7

Where to Find More Information

After you complete this guide, you can find more information in these guides:

Defining and packaging ActiveMatrix services in TIBCO ActiveMatrix Composite Editor User’s Guide

Developing ActiveMatrix components in TIBCO ActiveMatrix Service Grid Component Developer’s Guide

Developing mediation flows in TIBCO ActiveMatrix Service Bus Mediation Design Guide

Administration and deployment in TIBCO ActiveMatrix Administration

|

9

Chapter 2 Working with TIBCO Business Studio

The TIBCO ActiveMatrix service development tools consist of TIBCO Business Studio™ and a set of ActiveMatrix® plug-ins.

This chapter is a general guide to working with TIBCO Business Studio and ActiveMatrix SOA projects—you can review it before you begin, then refer to it as you follow the tutorial information in this guide.

Topics

Working with TIBCO Business Studio, page 10

Working with ActiveMatrix SOA Projects, page 11

Working with TIBCO Business Studio

The TIBCO ActiveMatrix development tools consist of TIBCO Business Studio Workbench and a set of TIBCO ActiveMatrix plug-ins. This section describes how to start TIBCO Business Studio. For information on TIBCO Business Studio, refer to the Workbench User Guide in the Workbench online help. To view the online help, select Help > Help Contents.

Starting TIBCO Business Studio

To start TIBCO Business Studio:

]

1. Execute one of these platform-specific commands:

]

Windows From the Start menu, follow the path All Programs > TIBCO >

ENV_NAME > TIBCO Business Studio 2.3 > TIBCO Business Studio.

From the command line on the Windows platform, run ENV_HOME/BusinessStudio/TIBCOBusinessStudio.exe. UNIX Run ENV_HOME/BusinessStudio/TIBCOBusinessStudio.

1. The Workspace Launcher appears. Accept the default workspace or browse to a new workspace.

2. Click OK.

3. The first time you run TIBCO Business Studio it displays a Welcome screen.

Dismiss the screen by clicking the X next to Welcome.

Working with ActiveMatrix SOA Projects

|

11

Working with ActiveMatrix SOA Projects

This section describes how to create ActiveMatrix SOA projects, import files into a project, and import sample projects.

Creating ActiveMatrix SOA Projects

ActiveMatrix SOA projects are containers for the ActiveMatrix resources that you can develop with TIBCO Business Studio.

To create anActiveMatrix SOA project:

1. Select File > New > ActiveMatrix Resources... > ActiveMatrix SOA Project.

2. Click Next.

3. Type a name in the Project name field.

4. Select the appropriate template.

5. Click Finish.

The new project is created. It appears in the Project Explorer tree with these ActiveMatrix folders:

A composite and service assembly are created in the project, based on the project name you typed in step 3. If the name you typed is ProjName, for example, a composite named ProjName.composite is created in the Composites folder and a service assembly named ProjName.saf is created in Deployment Packages folder.

Importing Projects and Files

This section describes how to import sample projects into a workspace, and how to import WSDL files into an ActiveMatrix SOA project.

Importing Sample Projects

To import sample projects:

1. Select File > Import.... to open the Import dialog box.

2. Expand the General node.

3. Select Existing Projects into Workspace.

4. Click Next to open the Import Projects dialog box.

5. Click the Browse.... button to the right of the Select root directory field.

a. Navigate to AMX_HOME/2.3/samples/amsb or AMX_HOME/2.3/samples/amsg.

b. Select one of the sample directories.

c. Click OK.

6. In the Projects area, check the checkboxes next to the projects to import.

7. Ensure that the Copy projects into workspace checkbox is selected.

8. Click Finish.

The projects you imported are now listed in the Project Explorer tree.

Importing WSDL Files

At various points throughout the example, you need to import WSDL files into the ActiveMatrix SOA project.

To import WSDL files from the file system:

When running Business Studio on Linux when using JDK 1.6 you may see multiple errors when importing samples. This occurs because of the maximum number of open files allowed. To change the limit of the maximum files that can be open:

1. Log in as a root user.

2. Edit /etc/security/limits.cof. 3. Add or edit the line:

* hard nofile 800000

The * refers to any user. Alternatively you may put a user name or

@somegroup, where the user that will run Business Studio belongs to the group somegroup. Set the number indicating the limit to a large number.

4. Save the file, log out and log back in and then start Business Studio.

Working with ActiveMatrix SOA Projects

|

13

1. In the Project Explorer view, right-click the ProjName > Service Descriptors folder and select Import > Service Import Wizard.

2. Accept the default selection Import from a File and click Next to open the WSDL Selection dialog box.

3. Click the Ellipsis button to the right of the Source Location field.

a. Navigate to a directory containing the WSDL file.

b. Click the file and then click Open.

4. Click Next.

5. Click Finish to import the WSDL file into your project.

|

15

Chapter 3 Hello World Mediation Example

This chapter is a tutorial that guides you through creating a mediation example, using mediation components.

Topics

• Hello World Mediation Example Overview, page 16

• Setting up the Hello World ActiveMatrix SOA Project, page 18

• Developing the Hello World Mediation Component, page 21

• Creating Shared Resources and Profiles, page 25

• Creating the Hello World SOAP Services and References, page 29

• Packaging the Hello World Example, page 33

• Deploying and Starting the Hello World Service Assembly, page 34

• Running the HelloWorld Example, page 38

Hello World Mediation Example Overview

This getting started example introduces mediation flows and mediation components using a simple application that sends a simple SOAP message to a service, and receives a simple SOAP reply message from the service.

As Figure 1 shows, the example enables a SOAP client to access a JMS service. The mediation component is implemented by a mediation flow that forwards the message from the SOAP client to the target service. The target service returns an acknowledgement string when the Hello World SOAP client submits a name. The mediation component writes an entry to the log, including the message data sent by the SOAP client.

Figure 1 Hello World Mediation Example

The Hello World mediation component is implemented by a mediation flow and executes in the mediation container. For the service to be accessible by way of the SOAP protocol, the example includes a Hello World SOAP service.

The Hello World SOAP client sends requests to the SOAP service, which forwards the requests to the Hello World mediation component. The mediation component executes the mediation flow that contains a Log task to write the incoming message to the log file. The request is then forwarded to the JMS reference to be sent to the target service. The response message from the target service is returned to the SOAP client through the same set of steps.

This chapter describes how to:

• Create an ActiveMatrix SOA project and import an abstract WSDL file into the project

• Create the Hello World mediation component and implementation in a mediation flow

• Create the Hello World SOAP service

• Create the Hello World JMS reference to the target service

www Hello World

Hello World Mediation Example Overview

|

17

• Package the service, component, and implementation artifacts into a service assembly

• Upload the service assembly to the ActiveMatrix environment, map service units to nodes, and map shared resource profiles to a shared resource

• Deploy and start the service assembly

• Invoke the Hello World service from a SOAP client

Sample Code

This chapter describes how to create and run the HelloWorld sample project. If you are already familiar with the TIBCO ActiveMatrix design environment and only want to deploy and run this project, you can find a complete working example in

AMX_HOME\2.3\samples\amsb\HelloWorld\com.tibco.amsb.sample.mediat

ion.helloworld. You can import the project into a workspace by following the procedure described in Importing Sample Projects on page 8.

If you import the sample project, you can skip to Deploying and Starting the Hello World Service Assembly on page 34 to deploy and run the sample.

Setting up the Hello World ActiveMatrix SOA Project

When you set up a SOA project in TIBCO Business Studio, you:

• Create the SOA project and folders

• Import WSDL files into the project

Starting TIBCO Business Studio

To start Business Studio:

1. Run one of these platform-specific commands:

]

Windows Start > All Programs > TIBCO > ENV_NAME > TIBCO Business Studio 2.3 > TIBCO Business Studio.

Or, from the Windows command line, run

ENV_HOME/BusinessStudio/TIBCOBusinessStudio.exe. UNIX Run ENV_HOME/BusinessStudio/TIBCOBusinessStudio.

1. The Workspace Launcher opens. Accept the default workspace or browse to a new workspace.

2. Click OK.

The first time you run Business Studio, the Welcome screen opens. Dismiss the screen by clicking the X next to Welcome.

Creating the Hello World ActiveMatrix SOA Project and Folders

ActiveMatrix SOA projects are containers for the ActiveMatrix resources that you develop using TIBCO Business Studio.

To create an ActiveMatrix SOA project for the Hello World example:

\\\

1. Start Business Studio and select File > New > ActiveMatrix Resources... >

ActiveMatrix SOA Project.

2. Click Next.

Setting up the Hello World ActiveMatrix SOA Project

|

19

3. Type HelloWorld in the Project name field, and ensure that Basic SOA Project template is selected the Available Templates list.

4. Click Next.

The Asset Type Selection dialog box opens, showing the assets selected for the new project.

5. Click Finish.

The HelloWorld project appears in the Project Explorer, with these folders:

• Composites

• Deployment Packages

• Mediation Flows

• Service Descriptors

• Shared Resources

A composite and a service assembly are created in the project, using the project name you specified in step 3—HelloWorld:

Importing the WSDL Files Into the Hello World Project

ActiveMatrix services are described using WSDL files—WSDL files specify the messages that are required to access a service.

To add the WSDL files to your HelloWorld project:

1. In the Project Explorer, right-click the HelloWorld > Service Descriptors folder and select Import > Service Import Wizard.

2. Accept the default selection Import from a File and click Next to open the WSDL Selection dialog box.

3. Click the Ellipsis button to the right of the Source Location field.

4. Navigate to the directory

AMX_HOME\2.3\samples\amsb\HelloWorld\com.tibco.amsb.sample.me diation.helloworld\ServiceDescriptors

5. Click the file HelloWorld.wsdl, then click Open.

6. Click Next.

7. Click Finish to import the WSDL file into your project.

The composite named HelloWorld.composite is created in the Composites folder.

The service assembly named HelloWorld.saf is created in the Deployment Packages folder.

The HelloWorld.wsdl file is an abstract WSDL and therefore has no binding to its target service. Later in this tutorial you’ll bind the WSDL to the target service, using the Composite Editor.

Developing the Hello World Mediation Component

|

21

Developing the Hello World Mediation Component

In this section of the tutorial you’ll:

• Create the Hello World mediation flow diagram

• Create the Hello World mediation component

Creating the Hello World Mediation Flow Diagram

To create the Hello World mediation flow diagram:

1. In the Project Explorer, open the HelloWorld project and right-click the Mediation Flows folder.

2. Choose New > Mediation Flow from the popup menu, to open the Create Mediation Flow wizard.

3. Select the method Single empty mediation flow, then click Next.

4. In the Mediation Flow Name field, type HelloWorld. 5. Click Finish.

The newly created mediation flow diagram HelloWorld.mediation opens in the Mediation Flow Editor:

— The left pane of the mediation flow, Mediation Interfaces, shows a mediation interface to which SOAP clients send messages.

— The right pane of the mediation flow, Target Interfaces, shows the interface for the target service where the messages are sent.

— The center pane of the mediation flow is the Mediation Path between the mediation and target interfaces.

— The Palette to the right of the mediation flow includes the tools you’ll use as you create the HelloWorld example.

Click the arrow to show or hide the palette.

6. Open the Service Descriptors folder, and drag and drop the HelloWorld >

Service Descriptors > HelloWorld.wsdl file into the center pane of the mediation flow diagram.

7. Click the sayHello operation in the Mediation Interfaces pane, then click the

sayHello operation in the Target Interfaces pane. A wire shows the mediation path from the mediation operation to the target operation.

8. Add a Log task to the input mediation path:

a. Click the Log icon in the palette.

b. Click the arrow between the sayHello mediation operation and the corresponding sayHello target operation.

9. Right-click the Log task on the mediation path and select Show Properties View from the drop-down menu.

The Properties view opens at the bottom of the workspace.

Developing the Hello World Mediation Component

|

23

10. Click the Log tab on the Properties view to configure the log task.

11. Select the Message Data item on the Log tab, to specify that the content of the message is to be written to the log file.

When this mediation flow executes, the message sent by the SOAP client to the target service travels along the mediation path, and the Log task on the path causes the message data to be written to the log file.

12. Save your project—click the Save icon in the toolbar, or click Ctrl + S.

Creating the Hello World Mediation Component

To create the Hello World Mediation component:

1. In the Project Explorer, open HelloWorld > Composites and double-click HelloWorld.composite.

The HelloWorld composite opens, showing the Services, Components, and References panes.

2. Click the Mediation component icon in the Components section of the Palette, then click on the Components canvas to add the component.

To add resources to a composite, you can either select a resource and click on the canvas, or drag and drop resources from the palette to the canvas.

3. Type HelloWorldMediationComp in the component’s activated input area.

4. Click the Implementation tab in the Properties view at the bottom of the workspace.

5. Click the Browse button on the tab to locate and select the

HelloWorld.mediation mediation flow resource.

6. Click OK.

7. Click the Save icon .

The component shows an error icon , indicating that you need to configure the rest of the composite.

Creating Shared Resources and Profiles

|

25

Creating Shared Resources and Profiles

In this section of the tutorial, you’ll:

Create shared resources. Shared resources are files that contain configuration information for resources that will be available for sharing among composites and components.

Add shared resource profiles to the composite. Composites and components use shared resource profiles to reference shared resources.

Creating Shared Resources

For the mediation service and target service to be accessible from external clients, you must create these shared resources:

• HTTP Server

• JMS

• JNDI

These resources are used by the services that expose the Hello World SOAP service to clients, and by the references to the target HelloWorld JMS service.

To create shared resources:

1. In the Project Explorer, right-click HelloWorld > Shared Resources and select New > HTTP Server.

The HTTP Server dialog box opens, showing the location and file name of the HTTP Server shared resource.

2. Click Finish. The HTTP Server Shared Resource Editor opens, showing the shared resource configuration.

3. In the Port field, type 9095. Do not change the remaining default values in the HTTP Server Shared Resource Editor.

4. Save the resource, then close the editor.

5. In the Project Explorer, right-click HelloWorld > Shared Resources and select New > JNDI.

The JNDI Shared Resource dialog box opens, showing the location and file name of the JNDI shared resource.

6. Click Finish. The JNDI Shared Resource Editor opens, showing the shared resource configuration.

7. Do not change the default values in the JNDI Shared Resource Editor. Save the resource, then close the editor.

Creating Shared Resources and Profiles

|

27

8. In the Project Explorer, right-click HelloWorld > Shared Resources and select New > JMS.

The JMS Shared Resource dialog box opens, showing the location and file name of the JMS shared resource.

9. Click Finish. The JMS Shared Resource Editor opens, showing the configuration of the shared resource.

10. In the Connection Type field, select JNDI from the drop-down list.

The JNDI Configuration Name field appears.

11. Click the JNDI Configuration Name icon to open the drop-down menu, and click Browse.

12. In the JNDI Configuration Name dialog, select the shared resource JNDI

Shared Resource.sharedjndiconfig from the Matching Resources list, and click OK.

13. Save the resource, then close the editor.

Adding Shared Resource Profiles to the Composite

Now that you’ve created the shared resources, you’ll add them to the HelloWorld composite.

To add the shared resource profiles to the HelloWorld composite:

1. If HelloWorld.composite is open, activate it by clicking the title tab of the composite editor.

If HelloWorld.composite is not open, go to Project Explorer > HelloWorld >

Composites and double-click HelloWorld.composite.

Open the JNDI Configuration Name icon and click Browse.

2. In the Properties view of HelloWorld.composite, click the Shared Resource Profiles view tab.

3. Add a new row to the table in one of these ways:

— Click the Add button to the right of the Shared Resource Profiles table.

— Click the ellipsis button in the Name column.

4. In the new row:

— Click in the Name column and type HTTP_Server.

— In the Type column, select HTTP.

— Click in the Target column, and within the column click the ellipsis button to open the Select Shared Resource dialog box.

— Select HTTP Server Shared Resource.sharedhttp and click OK.

5. Add another row to the table by clicking the Add button to the right of the table, or the ellipsis button in the Name column.

6. In the new row:

— Click in the Name column and type JMS.

— In the Type column, select JMS.

— Click the Target column, and within the column click the ellipsis button to

— Click the Target column, and within the column click the ellipsis button to

Related documents