Working with Consumer Mappings
Concept
Within an application, a Web service consumer proxy is called to consume a specific Web service. In standard software, a web service call like this is typically implemented independently of the version or interface of a specific Web service provider. Often different providers of a Web service offer different interfaces for the same purpose, but a Web service consumer might have to communicate with all of them. For example, different providers might use different numbers of operations or different data structures, or even different numbers of interfaces. To enable communication, a mapping mechanism is used on the consumer side. A mapping like this is called a consumer mapping. A consumer mapping maps the original consumer ( source consumer) to the consumer that matches the provider interface ( target consumer). The mapping can also be used to map one source consumer to multiple target consumers. For most use cases, a single target consumer is sufficient. Therefore, a consumer mapping is a single-target consumer mapping by default.
A consumer mapping references operation mappings for each operation of the source consumer. So the consumer mapping acts as an envelope for all of its operation mappings. In an operation mapping, a mapping implementation is defined. If each operation is handled by an operation mapping, the consumer mapping does not require an implementation. See the documentation below about direct mappings for special scenarios in which operations are not handled by operation mappings.
Single-Target Consumer Mappings (STCM)
A consumer mapping is called a single-target consumer mapping if all of its operation mappings have the same target consumer. This is the typical type of a consumer mapping. It reduces the complexity at configuration time because it can be configured like a normal consumer proxy. As this will cover most use cases, a consumer mapping is defined as a single-target consumer mapping (STCM) by default. A single-target consumer mapping can use an RFC consumer as target consumer. This enables calling a function module in a remote system, which can be useful for communication with systems that do not have a Web service infrastructure. For more information, see Creating RFC Consumers for Single-Target Consumer Mappings.
Use Cases for Single-Target Consumer Mappings (STCMs):
-
You can define STCMs to consume existing interfaces that were enhanced on provider side after the consumer application was implemented.
-
You can define STCMs with RFC consumers as target consumers to call function modules in other systems through Web services.
-
You can define multiple STCMs for different versions of one provider interface.
-
You can define multiple STCMs to consume different third-party interfaces for the same purpose.
Note that a single-target consumer mapping must include operation mappings for each operation. Instead of defining an operation mapping, you can use a direct mapping for an operation (see below). But direct mappings cannot be used in single-target consumer mappings.
Operation Mappings
You use operation mappings to map single operations from a source consumer to one or more target consumers. An operation mapping provides an interface with methods describing each separate mapping. To realize a specific mapping, this interface has to be implemented. You then include operation mappings in consumer mappings. The communication mode of the operation determines the number of methods that need to be implemented within the ABAP class for an operation mapping. For more information, see Basic Concepts of Consumer Mappings.
Direct Mappings
For very complicated use cases, in which operation mappings are not appropriate, you can define the mappings for operations as direct mappings in the consumer mapping. In a direct mapping, the source consumer is mapped directly to one or more target consumers, and a consumer mapping that contains direct mappings needs to be implemented. For a direct mapping, the message assembly as well as the call of the target consumers must be implemented. With this implementation, the developer gains more options to handle mapping scenarios, in which the number of calls of a target consumer must be determined dynamically. Also, with a direct mapping, it is possible to map an asynchronous operation of the source consumer to one or more synchronous operations of the target consumer. And you can modify the sequence of messages that are delivered exactly once and in order (EOIO). These options do not exist when operation mappings are defined.
Prerequisites
You use individual consumer proxies. Consumer mappings cannot be created for service groups.
Activities
Tasks at Design Time
Since consumer mappings describe data transformations on a business level, they are defined at design time.
-
For each operation of the source consumer, create operation mappings.
-
Create a consumer mapping by referencing operation mappings.
Tasks at Configuration Time
The configuration of single-target consumer mappings (STCM) works like the configuration of a normal consumer proxy. For other consumer mappings, all target consumers must be configured separately. Each consumer mapping has a logical port, to which the logical ports of the target consumers are assigned. The source proxy is then instantiated with the logical port of the mapping.
Monitoring Consumer Mappings
In the message monitor (transaction code SRT_MONI), you can view messages that originate from mappings. For each one, a parent message ID and the parent type Mapping are displayed. You can also display all messages related to an individual message by mapping.
For more information, see Monitoring ABAP Web Service Messages.