Today I supported a customer who want to build https proxy for third party sequence SOAP API calls and then call the the https proxy in an application .  This is new method to simplify the backend development .   I want to take this blog to demo an end to end SOAP API call in CPI .

I assume the readers have the following pre-requisits:

  1.  Have installed node .
  2.  Have installed git .
  3.  Have installed and configured  SAP clound connector .
  4.  Have installed  SOAP UI
  5.  Have installed Postman .

The following  is the steps for the end 2 end demo:

  1. Deploy local soap server
  2. Test soap server with Soap Ui
  3. Configure sap cloud connector to expose local soap server to CPI
  4. Build and deploy Iflow in CPI
  5. Test Iflowing with postman

Deploy local soap  server

git clone https://github.com/officer-rosmarino/node-soap-example.git

cd node-soap-example

npm install

node app.js

Test soap server with Soap Ui

download wsdl file with url: http://localhost:8000/wsdl?wsdl

use soap ui to test soap server

Configure sap cloud connector to expose local soap server to CPI

Build and deploy Iflow in CPI

The following is the code for step Groovy script 2

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import groovy.json.JsonSlurper;
import groovy.json.JsonOutput;
import groovy.json.*;

def Message processData(Message message) {
    //Body
    def body = message.getBody(java.lang.String) as String;
    def jsonSlurper = new JsonSlurper();
    def jsonbody = jsonSlurper.parseText(body);
    def msg = jsonbody.message;
    def splitter = jsonbody.splitter;
    
    //Properties
    message.setProperty("msg", msg);
    message.setProperty("splitter", splitter);
    return message;
}

 

<p2:MessageSplitterRequest xmlns:p2="http://tempuri.org/">
   <p2:message>${property.msg}</p2:message>
   <p2:splitter>${property.splitter}</p2:splitter>
</p2:MessageSplitterRequest>

the address and location id come from the following screen shot in BTP cockpit :

 

 

 

import com.sap.gateway.ip.core.customdev.util.Message;

def Message processData(Message message) {
    def body = message.getBody(java.lang.String) as String;

    def messageLog = messageLogFactory.getMessageLog(message);
    if(messageLog != null){

        messageLog.setStringProperty("Logging", "Printing Payload As Attachment");
        messageLog.addAttachmentAsString("Message#1", body, "text/plain");

    }
    return message;
}

 

Test Iflowing with postman

Get oauth2 information from  cpi runtime service key

 

Get URL from deployed Iflow:

 

Test in postman:

 

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x