19 Getting Started with Oracle Mediator

This chapter describes Oracle Mediator, which provides transformation, validation, and routing logic to Oracle SOA Suite applications. This chapter also describes how to create a Mediator component and the associated WSDL documents in Oracle JDeveloper.

This chapter includes the following sections:

19.1 Introduction to Oracle Mediator

Oracle Mediator is a service component of the Oracle SOA Suite that provides mediation capabilities such as selective routing, transformation, and validation capabilities, along with various message exchange patterns, such as synchronous, asynchronous, and event publishing or subscriptions.

Mediator provides a lightweight framework to mediate between various components within a composite application, such as business processes, human workflows, and so on, using a Web Services Description Language (WSDL) document as the interface. Mediator converts data to facilitate communication between different interfaces exposed by different components that are wired to build a SOA composite application. For example, Mediator can accept data contained in a text file from an application or service, transform it into a format appropriate for updating a database that serves as a customer repository, and then route and deliver the data to that database.

Mediator facilitates integration between events and services, where service invocations and events can be mixed and matched. You can use a Mediator service component to consume a business event or receive a service invocation. A Mediator service component can evaluate routing rules, perform transformations, validate, and either invoke another service or raise another business event. You can use a Mediator service component to handle returned responses, callbacks, faults, and timeouts.

19.2 Mediator Functionality

The following sections describe the primary functions that Oracle Mediator supplies to an Oracle SOA Suite application.

19.2.1 Content-Based and Header-Based Routing

Mediator enables you to define rules based on the message payload or message headers. You can select elements or attributes from the message payload or the message header and, based on the values in those elements or attributes, you can specify an action. For example, Mediator receives a file from an application or service containing data about new customers. Based on the country mentioned in the customer's address, you can route and deliver data to the database storing data for that particular country. Similarly, you can route a message based on the message header.

For more information about header-based routing, see How to Access Headers for Filters and Assignments.

19.2.2 Synchronous and Asynchronous Interactions

Mediator supports both synchronous and asynchronous request and response interactions. In a synchronous interaction, the client requests a service and then waits for a response to the request. In an asynchronous interaction, the client invokes the service, but does not wait for the response. You can specify a timeout period for an asynchronous interaction and you can specify an action to perform after the timeout period, such as to raise an event or start a process.

Mediator also supports event-based interactions. Events are one-way (fire-and-forget) asynchronous interactions.

For more information about synchronous and asynchronous interactions, see How to Configure Response Messages and Understanding Message Exchange Patterns of an Oracle Mediator.

19.2.3 Sequential and Parallel Routing of Messages

Mediator lets you specify that a routing rule be executed either in parallel or in sequence. You can configure the execution type from the Routing Rules section of the Mediator Editor.

For more information about sequential and parallel routing of messages, see How to Specify Sequential or Parallel Execution.

19.2.4 Message Resequencing

When you use the Mediator resequencer, it rearranges streams of related but out-of-sequence messages into their sequential order based on the type of resequencer used and the rules you define. When incoming messages arrive in a random order, the resequencer orders the messages based on sequential or chronological information, and then sends the messages to the target services in the correct order based on the resequencing configuration.

For more information about resequencing messages, see Resequencing in Oracle Mediator.

19.2.5 Data Transformation

Mediator lets you define data transformation from one XML schema to another. This feature enables data interchange among applications using different schemas. For example, you can transform a comma-delimited file to an XML schema that is compatible with a database.

For more information about transformations, see How to Create XSLT Transformations.

19.2.6 Payload Validation

You can configure Mediators to validate the incoming message payload using a Schematron or an XSD file. You can specify Schematron files for each inbound message part and Mediator executes Schematron file validations for those parts.

For more information about validations, see Specifying Validation and Priority Properties, How to Use Semantic Validation, and http://www.schematron.com/.

19.2.7 Java Callouts

Mediator lets you add Java callouts to the routing rules. Java callouts enable you to use external Java classes to manipulate messages flowing through the Mediator.

For more information about Java callouts, see How to Use Java Callouts.

19.2.8 Event Handling

An event is a message sent because an activity occurred in a business environment. Mediator can both subscribe to and raise business events. You can subscribe to a business event that is generated when a situation of interest occurs. For example, you can subscribe to an event that is generated when a new customer is created and then use this event to start a business process, such as sending a confirmation email. Similarly, you can generate business events when a situation of interest occurs. For example, after a new customer profile is created, you can generate a customer-created event.

For more information about event handling, see Using Business Events and the Event Delivery Network.

19.2.9 Dynamic Routing

Dynamic routing separates the control logic of a process from the execution of the process. The control logic determines the path taken by the process. You can create dynamic routing rules using the Mediator Editor.

For more information about dynamic routing, see How to Create Dynamic Routing Rules.

19.2.10 Error Handling

Mediator supports both manual error handling and error handling based on fault policies. A fault policy consists of conditions and actions, where the conditions specify the action to be carried out for a particular error condition.

For more information about error handling, see Using Oracle Mediator Error Handling.

19.2.11 Sending Messages Back to the Caller (Echo)

Mediator can echo source messages back to the initial caller without routing the message to another target. Mediator can perform transformations, validations, assignments, or sequencing operations before echoing the message back to the caller.

For more information about Mediator echo support, see "To echo a service:" of How to Specify Mediator Services or Events.

19.2.12 Multiple Part Messages

Mediator can process messages that consist of multiple parts. Some Remote Procedure Call (RPC) web services contain multiple parts in the SOAP message.

For more information about multiple part message support, see Working with Multiple Part Messages in Oracle Mediator.

19.3 Creating a Mediator

You can create a Mediator in multiple ways, depending on where you are in your application development process. Follow the appropriate instructions in the following sections to create the component.

19.3.1 How to Create a Mediator

You can create a Mediator in a SOA composite application in Oracle JDeveloper at any of the following points in the development cycle:

  • When you create a composite application

  • When you modify an existing composite application

  • When you create a project

  • When you modify an existing project

When you create a Mediator, the Create Mediator dialog appears so you can name the Mediator and select a template for the interface.

19.3.1.1 To create a composite application with a Mediator:
  1. Create and Name the SOA application and project using the Create SOA Application wizard.

  2. When you reach the Configure SOA Settings page, select Composite with Mediator in the Composite Template list, as shown in Figure 19-1.

    Figure 19-1 Composite with Mediator Selection in Create SOA Project Wizard

    Description of Figure 19-1 follows
    Description of "Figure 19-1 Composite with Mediator Selection in Create SOA Project Wizard"
  3. Click Finish.

    The Create Mediator dialog appears.

  4. Configure the Mediator interface, as described in Configuring the Mediator Interface Definition.

  5. Define routing rules for the Mediator, as described in Creating Oracle Mediator Routing Rules.

19.3.1.2 To create a Mediator in an existing composite application:
  1. Open the composite application to which you are adding a Mediator in the SOA Composite Editor.

  2. Drag and drop a Mediator from the Components window (shown in Figure 19-2) to the Components section of the editor.

    Alternatively, right-click a blank area in the Components section of the editor. Select Insert > Mediator from the context menu that appears.

    Tip:

    The Components window is to the right of the SOA Composite Editor.

    Figure 19-2 Components Window with a Mediator Service Component

    Description of Figure 19-2 follows
    Description of "Figure 19-2 Components Window with a Mediator Service Component"

    The Create Mediator dialog appears.

  3. Configure the Mediator interface, as described in Configuring the Mediator Interface Definition.

  4. Define routing rules for the Mediator, as described in Creating Oracle Mediator Routing Rules.

19.3.1.3 To create a new project with a Mediator:
  1. Right-click in the Applications window, and then select New.

    The New Gallery wizard appears.

  2. Create and name a new SOA project in the SOA Tier category.

  3. On the Configure SOA Settings page of the New Gallery dialog, select Composite With Mediator from the Composite Template list, shown in Figure 19-3.

    Figure 19-3 Create SOA Project Wizard with Composite With Mediator Template Shown

    Description of Figure 19-3 follows
    Description of "Figure 19-3 Create SOA Project Wizard with Composite With Mediator Template Shown"
  4. Click Finish.

    The Create Mediator dialog appears.

  5. Configure the Mediator interface, as described in Configuring the Mediator Interface Definition.

19.3.1.4 To create a Mediator in an existing project:
  1. In the Applications window, select the project to which you want to add a Mediator.

  2. Right-click in the navigator pane and select New.

  3. Under Categories, select Service Components, and then select Mediator from the Items list, as shown in Figure 19-4.

    Figure 19-4 New Gallery Dialog with Mediator Service Component

    Description of Figure 19-4 follows
    Description of "Figure 19-4 New Gallery Dialog with Mediator Service Component"
  4. Click OK.

    The Create Mediator dialog appears.

  5. Configure the Mediator interface, as described in Configuring the Mediator Interface Definition.

  6. Define routing rules for the Mediator, as described in Creating Oracle Mediator Routing Rules.

19.4 Introduction to the Mediator Editor Environment

You can create a Mediator service component in a SOA composite application of Oracle JDeveloper and then configure it using the Mediator Editor. To display the Mediator Editor, double-click the Mediator service component in the SOA Composite Editor. For information about the SOA Composite Editor, see Getting Started with Developing SOA Composite Applications.

Figure 19-5 shows the Mediator Editor along with the Applications window, Structure, and Messages windows.

Note:

Oracle recommends using a Unicode database with AL32UTF8 as the database character set for full globalization support in Mediator.

Figure 19-5 Mediator Editor Window

Description of Figure 19-5 follows
Description of "Figure 19-5 Mediator Editor Window"

Each section of the view shown in Figure 19-5 lets you perform specific design and deployment tasks. The sections in this view include the following:

  • Applications window

    The Applications window, shown in the upper left section of Figure 19-5, displays the Mediator mplan file. This file appears under the SOA Content folder of the project where you created a Mediator. For more information about the Applications window and the composite files, see Table 2-3.

  • Mediator Editor

    The Mediator Editor, shown in the middle of Figure 19-5, provides a visual view of the Mediator. This view appears when you perform one of the following actions:

    • Double-click an Oracle Mediator icon in the SOA Composite Editor.

    • Double-click the.mplan file for the Mediator in the Applications window.

  • Source View

    The Source view displays the source code of a Mediator. Click Source at the bottom of the Mediator Editor to view the source code. The code in Source view is immediately updated to reflect any changes to an a Mediator.

    The following example shows sample Mediator source code:

    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!--Generated by Oracle SCA Modeler version 1.0 at [4/16/07 10:05 PM].-->
    <Mediator name="CustomerDataRouter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.oracle.com/sca/1.0/mediator"/>
    
  • History Window

    The History window displays history information about the Mediator file, including a revision history and side-by-side comparisons of read-only and editable versions of a file. Click History at the bottom of the Design window shown in Figure 19-5 to open the History window. Figure 19-6 shows the History view for a Mediator file.

19.5 Configuring the Mediator Interface Definition

When you create a new Mediator, you can specify an interface template that generates a basic set of default files in the Mediator project. These files provide a framework from which you can design and configure the Mediator. You can create a Mediator with the following interface options:

  • Mediator with no interface definition

    This creates an empty Mediator and does not create a WSDL file. This method provides you with the flexibility to create the SOA components in the order you want.

    After you create a Mediator without an interface definition, you must create a service or an event that starts the component. You can also define the interface implicitly by dragging and dropping a service, or the output interface from another component, to the Mediator input.

  • Mediator with the interface defined by a WSDL file

    This bases the interface definition on a WSDL file, which describes the interfaces of a Mediator, such as port type, operations, services, and schemas. The WSDL file can already exist or you can generate one from a schema file.

  • Mediator with a one-way interface

    This defines an interface with a one-way interaction, where the client sends a message to a service and the service does not need to reply.

  • Mediator with a synchronous interface

    This creates an interface with synchronous request-response interactions. In a synchronous interaction, a client sends a request to a service and receives an immediate response. The client does not proceed further until the response arrives.

  • Mediator with an asynchronous interface

    This creates an interface with asynchronous request-response interactions. In an asynchronous interaction, a client sends a request to a service, but does not block and wait for a reply.

  • Mediator that subscribes to events

    This creates a Mediator that subscribes to a business event generated when a situation of interest occurs. A business event consists of message data sent as the result of an occurrence in a business environment. For information about business events, see Using Business Events and the Event Delivery Network.

    To subscribe to events, the events must be defined in an Event Definition (EDL) file.

19.5.1 How to Configure the Mediator Interface Definition

You configure the interface definition for a Mediator on the Create Mediator dialog.

To configure the Mediator interface definition:

  1. Create a Mediator using one of the methods described in Creating a Mediator.

    The Create Mediator dialog appears.

  2. In the Name field, enter a name for the Mediator service component.

  3. Select one of the following from the Template list. Refer to the descriptions at the beginning of this section for more information on each.

    • Define Interface Later

    • Interface Definition from WSDL

    • One-Way Interface

    • Synchronous Interface

    • Asynchronous Interface

    • Subscribe to Events

    Figure 19-7 and Figure 19-8 illustrate how the properties change on the Create Mediator dialog for different interface types.

    Figure 19-7 Synchronous Interface Template Selection on the Create Mediator Dialog

    Description of Figure 19-7 follows
    Description of "Figure 19-7 Synchronous Interface Template Selection on the Create Mediator Dialog"

    Figure 19-8 Interface Definition from WSDL Template Selection on the Create Mediator Dialog

    Description of Figure 19-8 follows
    Description of "Figure 19-8 Interface Definition from WSDL Template Selection on the Create Mediator Dialog"
  4. For any interface type except Subscribe to Events, configure the appropriate properties. For information about the displayed properties for each type, see Table 19-1 following these instructions.

  5. If you selected Subscribe to Events, do the following:

    1. Click Add on the Create Mediator dialog.

      Figure 19-9 Subscribe to Events Template Selection in Create Mediator Dialog

      Description of Figure 19-9 follows
      Description of "Figure 19-9 Subscribe to Events Template Selection in Create Mediator Dialog"

      The Event Chooser dialog appears.

    2. To the right of the Event Definition field, click Search.

      The SOA Resource Browser dialog appears.

    3. Select an event definition file (.edl) and click OK.

      The Event field is populated with the events described in the.edl file that you selected. For more information about creating.edl files, see Using Business Events and the Event Delivery Network.

    4. Select one or more events in the Event field, as shown in Figure 19-10, and click OK.

      Figure 19-10 Event Chooser Dialog

      Description of Figure 19-10 follows
      Description of "Figure 19-10 Event Chooser Dialog"
    5. Select a level of delivery consistency for the event.

      one and only one: A global (JTA) transaction is used for event delivery. If the event call fails, the transaction is rolled back and the call is retried a configurable number of times.

      guaranteed: A local transaction is used to guarantee delivery. There are no retries upon failure.

      immediate: Events are delivered on the same thread and on the same transaction as the caller.

    6. In the Run as publisher field, select whether to run the event subscription under the security of the event publisher.

      By default, event subscriptions run under the security of the event publisher.

    7. To filter the event, double-click the Filter column of the selected event, or select the event and then click the filter icon (first icon).

      The Expression Builder dialog appears.

    8. In the Expression field, enter an XPath expression and click OK.

      Figure 19-11 shows a sample Expression Builder dialog.

      Figure 19-11 Business Event Filter

      Description of Figure 19-11 follows
      Description of "Figure 19-11 Business Event Filter"

      The expression you created appears in the Filter column of the Create Mediator dialog.

    9. Click OK.

  6. Click OK on the Create Mediator dialog.

  7. If you chose to create a Mediator without an interface, you must create the interface at a later time as described in How to Define an Interface for a Mediator .

The following table lists and describes the properties you can configure to define an interface. The available properties change depending on the interface type you select, so not all of the listed properties apply to all interface types.

Table 19-1 Mediator Interface Properties

Property Description

Create Composite Service with SOAP Bindings

Select this option to create an exposed service with SOAP bindings that is automatically connected to your Mediator when the interface is generated.

WSDL URL

Enter the location of the WSDL file to use when creating the interface from a WSDL file. Do one of the following:

  • To use an existing WSDL file, enter the name of the file or click Find existing WSDL files to browse for the file.

  • To create a new WSDL file, click Generate WSDL from schema(s).

For more information about these options, see Generating a WSDL File.

Port Type

Select the port type name from the list. The available port types are parsed from the WSDL file that you specify in the WSDL URL field.

Callback Port Type

Select the port type name to which the response message is sent in an asynchronous communication. The available port types are parsed from the WSDL file that you specify in the WSDL URL field.

Input

Enter the schema element for the input message. Click Search to the right of the field to select the element. By default, the singleString schema element is selected for the input message.

For a sample schema, see the schema that follows after this table.

Output

Enter the schema element for the output message. Click Search to the right of the field to select the element. By default, the singleString schema element is selected for the input message.

You can use any XSD schema to specify the format of the input document that Mediator processes. Here is a sample schema:

<xsd:schema attributeFormDefault="qualified"
            elementFormDefault="qualified"
            targetNamespace="http://samples.otn.com/helloworld"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://samples.otn.com/helloworld">
         <include namespace="http://samples.otn.com/helloworld"
            schemaLocation="helloworld.xsd" />
         <xsd:element name="name1" type="xsd:string" />
         <xsd:element name="result1" type="xsd:string"/>
</xsd:schema>

19.5.2 What Happens When You Create a Mediator

The Mediator files are generated under the specified application and project in the Applications window, and the new Mediator appears in the Mediator Editor in Design view. If you created the Mediator with an interface definition and the WSDL file did not already exist, the new WSDL file is also generated with the same name as the Mediator. If the WSDL file you specified is located in a different directory than the project files, the file and its associated schema files are copied to the Mediator project.

19.5.2.1 Without an Interface Definition

This Mediator has no associated WSDL file, port types, or operations. You must define these separately as described in Defining an Interface for a Mediator. Figure 19-12 shows how a Mediator created with no interface definition appears in the Mediator Editor.

Figure 19-12 Mediator with no Interface Definition in the Mediator Editor

Description of Figure 19-12 follows
Description of "Figure 19-12 Mediator with no Interface Definition in the Mediator Editor"
19.5.2.2 With a WSDL-Based Interface

The appearance and source code of this Mediator varies depending on the name of the WSDL file and the port types and operations defined by the WSDL file. Figure 19-13 shows a sample Mediator created from a WSDL file.

Figure 19-13 Mediator from WSDL in the Mediator Editor

Description of Figure 19-13 follows
Description of "Figure 19-13 Mediator from WSDL in the Mediator Editor"
19.5.2.3 With a One-Way Interface Definition

Figure 19-14 shows how a Mediator created with a one-way interface appears in the Mediator Editor. The arrow to the left of the execute operation represents a one-way operation.

Figure 19-14 One-Way Interface Oracle Mediator in the Mediator Editor

Description of Figure 19-14 follows
Description of "Figure 19-14 One-Way Interface Oracle Mediator in the Mediator Editor"
19.5.2.4 With a Synchronous Interface Definition

In a synchronous interaction, only one port is defined because the response is sent to the same port as the request. Figure 19-15 shows how a Mediator created with a synchronous interface appears in the Mediator Editor. The arrows to the left of the execute operation in Figure 19-15 represent a synchronous operation.

Figure 19-15 Synchronous Mediator in the Mediator Editor

Description of Figure 19-15 follows
Description of "Figure 19-15 Synchronous Mediator in the Mediator Editor"
19.5.2.5 With an Asynchronous Interface Definition

Figure 19-16 shows how a Mediator created with an asynchronous interface appears in the Mediator Editor. The Port Type field displays the port on which the request message is sent. The Callback Port Type field displays the port to which the response is sent. The arrows to the left of the execute operation in Figure 19-16 represent an asynchronous operation.

Figure 19-16 Asynchronous Mediator in the Mediator Editor

Description of Figure 19-16 follows
Description of "Figure 19-16 Asynchronous Mediator in the Mediator Editor"
19.5.2.6 With an Event Subscription

When you view the Mediator in the SOA Composite Editor, the icon on the left side of the Mediator indicates that this Mediator is configured for an event subscription, as shown in Figure 19-17.

Figure 19-17 Mediator Created with the Subscribe to Events Template

Description of Figure 19-17 follows
Description of "Figure 19-17 Mediator Created with the Subscribe to Events Template"

When you double-click the Mediator, the Mediator Editor appears, as shown in Figure 19-18.

Figure 19-18 Event Subscription Mediator in the Mediator Editor

Description of Figure 19-18 follows
Description of "Figure 19-18 Event Subscription Mediator in the Mediator Editor"

19.6 Defining an Interface for a Mediator

After you create a Mediator without an interface definition, you must define the interface by subscribing to events or by defining services. You can define services in the following two ways:

  • Connect the Mediator to a service through a wire in the SOA Composite Editor.

  • Use the Define Service or Add Event Subscription option in the Mediator Editor.

19.6.1 How to Define an Interface for a Mediator

The following procedures describe how to define an interface for an existing Mediator by subscribing to events, by defining services creating a wire in the composite, and by defining services using the Mediator Editor.

19.6.1.1 To Subscribe to Events:

To subscribe to events, the events must be defined in an Event Definition (EDL) file.

  1. Open the Mediator you want to edit in the Mediator Editor.

  2. In the Routing Rules section, click Add Event Subscription.

    The Subscribed Events dialog appears.

  3. Click Add.

    The Event Chooser dialog appears.

  4. To use an existing EDL file, follow the instructions under Configuring the Mediator Interface Definition beginning with Step 55.b.

    Note:

    You can alternatively create a new EDL file. Click Create EDL file to create a new EDL file. Enter the event details in the Create Event Definition dialog that appears.

  5. Click OK.

19.6.1.2 To Define Services for a Mediator Using a Wire:
  • In the SOA Composite Editor, drag a wire from a Mediator to a service.

    For more information about wires and how to wire a service component to a service, see How to Wire a Service and a Service Component.

    Note:

    You can also wire a Mediator with a defined service interface to another interface. However, to connect a Mediator to a service, the interface of the Mediator and of the service must match.

    When you define a service using a wire, the service for the Mediator is automatically defined using the WSDL file from the wire source. For example, if you connect the ReadFile service shown in Figure 19-19 to the CustomerDataRouter Mediator, the CustomerDataRouter Mediator automatically inherits the service definition of the ReadFile service.

    Figure 19-19 Connecting Mediator to a Service

    Description of Figure 19-19 follows
    Description of "Figure 19-19 Connecting Mediator to a Service"

    For information about how wiring two Mediator service components can cause an infinite loop, see What You May Need to Know About Adding and Deleting Wires.

19.6.1.3 To Define Services for a Mediator in the Mediator Editor:
  1. Display the Mediator you want to edit in the Mediator Editor.

  2. To the right of the WSDL URL field, click Define Service.

    The Define Service dialog appears, as shown in Figure 19-20.

    Figure 19-20 Define Service Dialog

    Description of Figure 19-20 follows
    Description of "Figure 19-20 Define Service Dialog"
  3. Do one of the following:

    • To use an existing WSDL file, click Find existing WSDLs to the right of the WSDL URL field.

    • To create a WSDL file, click Generate WSDL from schema(s) to the right of the WSDL URL field.

    For information about how to generate a WSDL file, see Generating a WSDL File.

  4. From the Port Type list, select a port.

  5. From the Callback Port Type list, select a port for the response message in an asynchronous interaction.

  6. Click OK.

19.7 Generating a WSDL File

You can generate the WSDL file for a message using an XML schema definition (XSD) file. When working with Mediator, you can generate a WSDL file at either of the following times:

  • When you are creating a Mediator and you select the Interface Definition from WSDL template in the Create Mediator dialog, selecting Generate WSDL from Schema(s) next to the WSDL URL field opens the Create WSDL dialog.

  • When you have a Mediator with no interface defined and you click Define Service next to the WSDL URL field in the Mediator Editor, selecting Generate WSDL from Schema(s) next to the WSDL URL field opens the Create WSDL dialog.

The Create WSDL dialog populates standard fields, such as the file name, directory, and namespace; and the dialog changes depending on the interface type you select. You can specify the same or different schema files for the message inputs.

19.7.1 How to Generate a WSDL File

The way you configure a WSDL file depends on the type of interface being defined by the WSDL file. You can define a one-way interface, a synchronous interface, or an asynchronous interface.

19.7.1.1 To generate a WSDL file for a one-way interface from an XSD file:

Perform these steps after the Create WSDL dialog appears when you are creating a Mediator or when you are defining a service for a Mediator.

  1. On the Create WSDL dialog, accept the default values or enter the following information for the WSDL file:

    Table 19-2 WSDL Properties

    Property Description

    File Name

    A unique name for the WSDL file.

    Directory

    The directory where you want to store the WSDL file. By default, it is stored in the SOA/WSDLs folder under the project folder.

    Namespace

    A namespace address for the WSDL file; for example, http://oracle.com/esb/namespaces/Mediator. The default namespace is based on the JDeveloper application name, project name, and the mediator name.

    The namespace that you specify is defined as the tns namespace in the WSDL file.

    Port Type

    The name of the port type in the WSDL file that contains the operation to use.

    Operation

    The name of the action to perform; for example, executeQuery.

    Note:

    Spaces and special characters are not allowed in an operation name or port type. Only alphabetic and numeric characters are supported, and the first character cannot be a number.

  2. In the Interface Type field, select One-Way Interface.

    The Input field appears, as shown in Figure 19-21.

    Figure 19-21 Create WSDL Dialog for a One-Way Interface

    Description of Figure 19-21 follows
    Description of "Figure 19-21 Create WSDL Dialog for a One-Way Interface"
  3. To the upper right of the Input field, click Add a new message part.

    The Add Message Part dialog appears, as shown in Figure 19-22.

    Figure 19-22 Add Message Part Dialog

    Description of Figure 19-22 follows
    Description of "Figure 19-22 Add Message Part Dialog"
  4. In the Part Name field, enter a name for the message part.

  5. To the right of the URL field, click the browse for schema file icon to browse for the URL.

    The Type Chooser dialog appears and contains a list of the schema files (XSD files), as shown in Figure 19-23.

    Figure 19-23 Type Chooser Dialog

    Description of Figure 19-23 follows
    Description of "Figure 19-23 Type Chooser Dialog"
  6. Expand the Type Explorer tree to locate and select the schema element to use.

    If the schema you want to use is not located in the project in which you are working, you can import a schema XSD file or WSDL file into the project using the Import Schema File or Import WSDL icon in the upper right corner of the dialog.

    After you specify a file, Oracle JDeveloper parses it to determine the defined schema elements and displays them in a list from which you select.

  7. Select the root element of the XSD file and click OK.

    The Add Message Part dialog reappears with the URL and Schema Element fields populated from the Type Chooser dialog. If you selected an XSD simple type, these fields are replaced by a Simple Type field.

  8. Click OK on the Add Message Part dialog.

    The input information appears in the Input field of the Create WSDL dialog.

  9. If needed, repeat the above steps to define additional message parts.

  10. Click OK.

    Note:

    Partner link types are generally used in BPEL, so you do not need to select Generate partnerlinkType extension for Mediator.

19.7.1.2 To generate a WSDL file for a synchronous interface from an XSD file:

Perform these steps after the Create WSDL dialog appears when you are creating a Mediator or when you are defining a service for a Mediator.

  1. On the Create WSDL dialog, enter the information for the properties listed in Table 19-2.

  2. In the Interface Type field, select Synchronous Interface.

    The Input, Output, and Fault fields appear, as shown in Figure 19-24.

    Figure 19-24 Create WSDL Dialog for a Synchronous Interface

    Description of Figure 19-24 follows
    Description of "Figure 19-24 Create WSDL Dialog for a Synchronous Interface"
  3. Repeat steps 3 to 8, as in the previous procedure.

  4. Repeat the same steps to define message parts for the Output and Fault fields.

    The output represents the response message and is required in synchronous transactions. Faults are optional.

  5. Click OK.

    Note:

    Partner link types are generally used in BPEL, so you do not need to select Generate partnerlinkType extension for Mediator.

19.7.1.3 To generate a WSDL file for an asynchronous interface from an XSD file:

Perform these steps after the Create WSDL dialog appears when you are creating a Mediator or when you are defining a service for a Mediator.

  1. On the Create WSDL dialog, enter the information for the properties listed in Table 19-2.

  2. In the Interface Type field, select Asynchronous Interface.

    The Input field and Callback section appear, as shown in Figure 19-25.

    Figure 19-25 Create WSDL Dialog for an Asynchronous Interface

    Description of Figure 19-25 follows
    Description of "Figure 19-25 Create WSDL Dialog for an Asynchronous Interface"
  3. Repeat steps 3 to 8, as in the earlier procedure.

  4. Repeat the same steps to define the input message parts for the Callback section.

    Note:

    The callback input represents the response message and is required in asynchronous transactions.

  5. In the Callback section, specify the following information for the response message:

    • Port Type: The name of the port type in the WSDL file that contains the operation to use.

    • Operation: The name of the action to perform; for example, executeResponse.

      Note:

      Spaces and special characters are not allowed in an operation name or port type. Only alphabetic and numeric characters are supported, and the first character cannot be a number. Both of these fields are required.

  6. Click OK.

    Note:

    Partner link types are generally used in BPEL, so you do not need to select Generate partnerlinkType extension for Mediator.

19.8 Specifying Validation and Priority Properties

After creating a Mediator, you can configure properties for the operation or event subscription specified for the component. On the Mediator Editor, you can specify whether to validate the schemas of inbound messages and you can specify a priority for the operation or event subscription.

To validate inbound message schemas, select the Validate Syntax (XSD) check box for an operation or event subscription in the Routing Rules section of the Mediator Editor. The Mediator Engine validates the XML inbound payload syntactic structure against the associated XML schema. Any syntax error, such as an incorrect element name or location, causes a fault and the routing rule is not processed.

To specify a priority for an Oracle Mediator component, select a value from zero to nine in the Priority field in the Mediator Editor's Routing Rules section. This determines the order in which messages are retrieved for all Oracle Mediator service components. This property is only valid for parallel routing rules and not sequential. For more information about priorities, see "Basic Principles of Parallel Routing Rules".

19.9 Modifying a Mediator Service Component

You can modify the operations or event subscriptions of a Mediator using the Mediator Editor.

19.9.1 How To Modify Mediator Operations

You can modify an Oracle Mediator WSDL file by adding or deleting operations. After modifying the WSDL file, use the Refresh WSDL dialog to synchronize the changes.

To modify operations:

  1. In the Mediator Editor, click the Refresh operations From WSDL icon to the right of the WSDL URL field.

    The Refresh WSDL dialog appears. If you have made any modifications to the WSDL file, the Refresh WSDL dialog lists all the operations to delete or add. The Refresh will delete Mediator operation field lists all the operations that have been removed from the WSDL file. The Refresh will add Mediator operation field lists all the new operations that have been added in the WSDL file. Figure 19-26 shows the Refresh WSDL dialog.

    Figure 19-26 Refresh WSDL Dialog

    Description of Figure 19-26 follows
    Description of "Figure 19-26 Refresh WSDL Dialog"
  2. To specify a different WSDL file, click Find existing WSDLs to the right of the WSDL URL field to use an existing WSDL file or Generate WSDL From schema(s) to create a WSDL file.

    The Refresh WSDL dialog is updated based on the operations defined in the specified WSDL file.

  3. Click OK.
  4. From the File menu, select Save All.

19.9.2 How To Modify Mediator Event Subscriptions

You can subscribe to new events, modify existing event subscriptions, and unsubscribe from subscribed events using the Manage Event Subscriptions option in the Mediator Editor.

To modify event subscriptions:

  1. In the Mediator Editor, click the Manage Event Subscriptions icon to the right of Event Subscriptions.

    The Subscribed Events dialog appears, as shown in Figure 19-27.

    Figure 19-27 The Subscribed Events Dialog

    Description of Figure 19-27 follows
    Description of "Figure 19-27 The Subscribed Events Dialog"
  2. You can perform any of the following functions:
    • Subscribe to a new event.

    • Unsubscribe from an event.

    • Modify or specify the filter criteria for an event.

    • Modify the Consistency or Run as Roles properties of an event subscription.

      For more information about the Consistency, Run as Roles, and Filter fields of an event, see How to Configure the Mediator Interface Definition.

  3. Click OK.
  4. From the File menu, select Save All.