Invoking a Web Service via Email

Version: 17.07

Supported Since: 17.01

Use Case Description

I have an integer multiplication web service exposed over HTTP, and want to make it accessible via email, where emails containing the input data sent to a predefined address are processed and replied to with the multiplication results.

Solution

UltraESB-X can be configured to proxy messages between the email service and the web service in order to enable the acceptance of data from and propagation of results to email senders.

UltraStudio Configuration

UltraESB-X Configuration

Implementation of the Solution

Prerequisite

In order to implement above use case you must first select following dependencies when you are creating a new Ultra project.

  • Mail Connector from the connector list

  • NIO HTTP Connector from the connector list

  • Transport Header Manager from processor list

If you have already created a project, you can add above dependencies via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list and Processors list, select above dependencies.
Implementation

To implement above use case, first create an integration flow named “web-service-via-email-flow”, and then add required components by going through following steps in order.

  1. Add a Mail Ingress Connector from the Connectors → Ingress Connectors list, to accept incoming multiplication request emails, with the configuration shown below (assuming a Gmail account)

  2. Add an Add Variable processing element from the Processors → Generic list, to extract the value of the retained From header (sender’s email address) into a recipient variable

  3. Add a NIO HTTP Egress Connector from the Connectors → Ingress Connectors list, to forward the received request to the multiplication web service

  4. Add an Add New Transport Header processing element from the Processors → Header Manipulation list, to set the subject of the response email

  5. Restore the previously saved sender’s email address from recipient variable into the mail.to transport header, using another Add New Transport Header processing element

  6. Add a Mail Egress Connector to send the response back to the sender (assuming a Gmail account)

  7. Finally add a Successful Flow End processing element to complete the flow

The completed integration flow should look like below.

web service via email component complete flow

Configuration for each element is as below. The numbering corresponds to the numbers shown in above diagram.

Design View

Text View

.

1. Mail Ingress Connector (Basic Tab)

web service via email component 1

For other settings, specify below Map entries

web service via email component pop map

1. Mail Ingress Connector (Processing Tab)

web service via email component 1 1

1. Mail Ingress Connector (Scheduling Tab)