Skip to Content
Technical Articles

CPI OData Calculator: SOAP Source (with Groovy Script on the Message Mapping)


As SAP® “speaks” OData (Mobile, FIORI, etc.), my goal here is to demonstrate how the “OData conversion” works on CPI, creating a simple Calculator (multiply operation) iFlow:

We have a few options as the data source on the OData iFlow creation, in this blog i’m gonna use the SOAP one.

For the SOAP Webservice, i’m gonna use the This is a FREE Calculator SOAP Webservice that will do just fine for the desired scenario.

So first things first, download the WSDL file here, we’re using the Multiply operation.

Play around with it if you want, note the test below (using SOAPUI):

It has 2 inputs and the result output.

So let’s create our scenario, on your CPI package create a OData Service:

Place your desired info:

Lets create our Entity Set from the WSDL file:

Mapping both the Inputs parameters and Output result:

Renamed the Fields and Entity Set (also changed the data type to String):

For the Multiply operation, let’s use the Create (POST) operation. So select the binding:

Use the WSDL again, to tell the operation that the iFlow needs to use, like this:

It will generate an iFlow, in the end it should look like these:

So first, let’s create a Content Modifier to capture the 2 Input fields on the Payload (using XPath):

After that, open the Request Mapping and:

On the SOAP Request-reply, don’t forget to replace the Auth to None:







On the response mapping, we’re mapping like these:


For the SOAP1 and SOAP2 fields, we want to send it back together with the result, because the SOAP WS just returns the value. For that, as we’ve created Property for the 2 inputs(on the Content Modifier above), we can access them using Groovy Script:


def String SOAP1(String arg1, MappingContext context) {
         String SOAP1 = context.getProperty('SOAP1');
         return SOAP1;
def String SOAP2(String arg1, MappingContext context) {
         String SOAP2 = context.getProperty('SOAP2');
         return SOAP2;

Created like this, to show also how we could pass parameters to the script(this time, we’re not using, just using the Context):

Now save everything, it should look like these:

Deploy and let’s test it (using Postman):

First, don’t forget to get the Token(X-CSRF-Token) from a simple Get to the OData root URL service. After that, let’s make a POST request using the payload below:

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="" xmlns:m="" xmlns:d="">
 <content type="application/xml">

And Voilà:

Next up, we’re gonna create from a REST data source.



Be the first to leave a comment
You must be Logged on to comment or reply to a post.