During one of my recent XI projects, I have to configure a SAP XI mail sender communication channel (CC) to poll mails from a POP3 mail server. Two of the mandatory fields for the sender mail CC are the default interface and the default namespace. If you provide a specific message interface as a default interface, you are obliged to create a CC for each possible message interfaces. This weblog describes one possible solution to use only one mail sender CC for multiple interfaces with different message types.
An external partner sends mail with an attachment to a specific email address. The attachment contains the message interface or with others words; it contains an xml with the message type of the interface. The partner can send different messages (interfaces) to the same email address. The subject of the email is used to differentiate between the different messages. E.g. the partner can send OrderConfirmation and CargoManifest to the same email address. Each interface starts a specific integration process.
Figure 1: Scenario
In the Repository, you have defined the necessary interfaces, message types and data types. For example, you have interfaces for OrderConfirmation and CargoManifest with respective MT_OrderConfirmation and MT_CargoManifest as message types.
The message interface that you use to configure the communication channel doesn’t exist in the repository. In this example I will use the following interface:
- Name: MI_Out_Mail_Generic_Message
- Namespace: http://mycompany.com/xi/mail/Generic
For each possible message interface, you may require to create a BPM if the message type of the receiver interface is not the same as the message type of the sender interface. The inbound message of the BMP must be the same as the sender message type. The message mapping of the sender message type to the receiver (or BPM) message type is implicit so you don’t have to create it.
If you create a configuration scenario, you can use the generic interface in the action definition.
Figure 2: Action definition with generic interface.
The generic interface is also used in the Connection definition. You don’t have to provide a message mapping.
Figure 3: Generic interface in Connection definition
In the mail sender communication channel, you enter the generic interface as value for the default interface with a dummy namespace.
Figure 4: Configuration of the communication channel
Use the condition rules to determine the receiver services. You can combine the Subject field iwith the From field to use the same email address to receive interfaces from different partners. If a receiver system can receive multiple messages, you need to create a BPM for each message. As stated above in the Repository part, the inbound message type of the BPM must be the same as the message type of the message in the attachment of the mail.
You don’t have to specify an interface mapping in the Interface determination. The receiver interface must have the same message type as the message type in the attachment of the email.
Figure 5: Interface determination
It is possible to use one mail sender communication channel to process multiple message interfaces/types. This solution uses a generic message interface to kick start the integration process.