Specifying Operation or Event Subscription Properties Introduction to Routing Rules

18-36 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite 19 Creating Oracle Mediator Routing Rules 19-1 19 Creating Oracle Mediator Routing Rules This chapter provides an overview of routing rules and describes how to specify routing rules for an Oracle Mediator service component. This chapter includes the following sections: ■ Section 19.1, Introduction to Routing Rules ■ Section 19.2, Defining Routing Rules ■ Section 19.3, Creating an Oracle Mediator for Routing Messages ■ Section 19.4, Creating an Asynchronous Request and Response Using Oracle Mediator

19.1 Introduction to Routing Rules

Oracle Mediator lets you route data between service consumers and service providers. As the data flows from service to service, it must be transformed. These two tasks, routing and transformation, are the core responsibilities of Oracle Mediator. You can use routing rules to specify how a message processed by an Oracle Mediator reaches its next destination. Routing rules specify where an Oracle Mediator sends the message, how it sends the message, and what changes should be made to the message structure before sending it to the target service. Routing rules can be of the following two types: ■ Static Routing Rules Static rules do not change depending on the invocation context and are applied consistently. ■ Dynamic Routing Rules Dynamic rules let you externalize the routing logic to an Oracle Rules Dictionary, which in turn enables dynamic modification of the routing logic. For more information about creating routing rules, see Section 19.2.2, How to Create Static Routing Rules and Section 19.2.3, How to Create Dynamic Routing Rules.

19.2 Defining Routing Rules

Routing rules can only be defined for an Oracle Mediator with a defined interface. For more information on how to define an interface, see Section 18.4.1.3, How to Define an Interface for an Oracle Mediator. 19-2 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite

19.2.1 How To Access the Routing Rules Section

You define the routing rules in the Routing Rules section of the Mediator Editor. To access the routing rules section: You can access the Routing Rules section of the Mediator Editor using one of the following methods: ■ From the SOA Composite Editor: a. Double-click the icon that represents the Oracle Mediator for which you want to specify the routing rules. b. If the Routing Rules section is not visible, click the Plus + icon next to Routing Rules . ■ From the Application Navigator: a. In the Application Navigator, expand the SOA project and then expand the SOA Content folder.

b. In the SOA Content folder, double-click the name of the Oracle Mediator file

in which you want to specify the routing rules. The Oracle Mediator file has an MPLAN extension. c. If the Routing Rules section is not visible, click the Plus + icon next to Routing Rules . Figure 19–1 shows the Routing Rules section of the Mediator Editor. Figure 19–1 Mediator Editor- Routing Rules Section Creating Oracle Mediator Routing Rules 19-3 Figure 19–2 lists and describes the icons in the Routing Rules section. Figure 19–2 Routing Rule Section Icons

19.2.2 How to Create Static Routing Rules

When you define static routing rules, you can configure the following information and types of rules: ■ Target service Oracle Mediator sends messages to the target service you specify. This service can either be defined as a WSDL interface or a Java interface. For information about invoking a target service, see Section 19.2.2.1, How to Specify Oracle Mediator Services or Events . ■ Execution type Oracle Mediator executes routing rules either sequentially or in parallel. For information about specifying an execution type, see Section 19.2.2.3, How to Specify Sequential or Parallel Execution . ■ Reply, callback, and fault handlers You can define how Oracle Mediator handles synchronous reply, callback, and fault messages. For information about handlers, see Section 19.2.2.4, How to Configure Response Messages and Section 19.2.2.6, How to Handle Faults . ■ Filter expression You can define a filter expression that is applied to the message content payload or headers. When you define a filter, the contents are analyzed before any service is invoked. For example, you might apply a filter expression that specifies that a service be invoked only if the message includes a customer ID, or if the value for that customer ID matches a certain pattern. For information about specifying filter expressions, see Section 19.2.2.7, How to Specify an Expression for Filtering Messages . ■ Transformations 19-4 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Oracle Mediator can transform message data before forwarding the message to a service. You can define transformations to set a value on the target payload by mapping data or by assigning values. The XSLT Mapper lets you to define transformations that apply to the whole message body to convert messages from one XML schema to another. The Assign Values function works on individual fields. Using this dialog, you can assign values from the message for example, payload and headers, from a constant, or from various system properties, such as the properties of an adapter present in the data path. For information about defining transformations, see Section 19.2.2.8, How to Create Transformations and Section 19.2.2.9, How to Assign Values . ■ Accessing header variables from expressions Oracle Mediator can detect any SOAP headers that are used in building the expression for the current routing rule operation. For information about accessing headers, see Section 19.2.2.11, How to Access Headers for Filters and Assignments and Section 19.2.2.11.2, Manual Expression Building for Accessing Properties for Filters and Assignments . ■ Schematron-based validations You can specify the Schematron files that Oracle Mediator should use to validate different parts of an inbound message. For information about performing Schematron-based validations, see Section 19.2.2.12, How to Use Semantic Validation . ■ Java callout Custom Java class callouts let you use regular expressions with Java code, when regular expressions alone do not suffice. For information about using Java callouts, see Section 19.2.2.13, How to Use Java Callouts . ■ User-defined extension functions These are your own set of functions that can be used by the XSLT Mapper. For information about using user-defined extension functions, see To add user-defined extension functions: .

19.2.2.1 How to Specify Oracle Mediator Services or Events

After creating an Oracle Mediator component, you associate it with inbound service operations or event subscriptions and with outbound targets. Targets are outbound service operations or event publishing. A target specifies the next service or event to which an Oracle Mediator sends messages and also specifies which service operation to invoke. You can specify a service or an event as a target type. You can also echo source messages back to the initial caller after any transformation, validations, assignments, or sequencing operations are performed. An echo can only be specified if the Oracle Mediator component has a synchronous or asynchronous interface. Whether the echo is synchronous or asynchronous depends on the WSDL file of the caller. The echo option is only available for inbound service operations and is not available for event subscriptions. The purpose of the echo option is to expose all the Oracle Mediator functionality as a callable service without having to route it to any other service. For example, you can call an Oracle Mediator to perform a transformation, a validation, or an assignment, and then echo the Oracle Mediator back to your application without routing it anywhere else. You can specify multiple routings for an inbound operation or event. Each routing is mapped to one target service invocation or event. Therefore, to specify multiple