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:
-
Have installed node .
-
Have installed git .
-
Have installed and configured SAP clound connector .
-
Have installed SOAP UI
-
Have installed Postman .
The following is the steps for the end 2 end demo:
-
Deploy local soap server
-
Test soap server with Soap Ui
-
Configure sap cloud connector to expose local soap server to CPI
-
Build and deploy Iflow in CPI
-
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:
Subscribe
Login
Please login to comment
0 Comments