Technical Articles
Call deployed CPI iflow from BTP sapui5 application by using ajax
Cloud process integration can be used to do process integration, but also can be used to simplify development . We can put together backend service in an iflow for a front end application like SAP UI5 . Today I will demo the process . To simplify the demo, I will demo the process base on the blog Trigger a Workflow Instance from a SAPUI5 Application developed in a Multitarget Application by Mariajose Martinez .
Step 1, Deploy an iflow in Cloud process integration :
The following is the code in script1.grouvy
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
def body = message.getBody(java.lang.String)
def messageLog = messageLogFactory.getMessageLog(message)
if (messageLog != null) {
messageLog.addAttachmentAsString('ui5message', body, 'text/plain')
}
return message
}
After deployment, the runtime is in the following screenshot :
Step 2, create destination for cloud process integration runtime service key in BTP cockpit .
Step 3, Build and deploy the code base on the blog Trigger a Workflow Instance from a SAPUI5 Application developed in a Multitarget Application by Mariajose Martinez . . Make some the following adjustment for Iflow rest api call.
Please note the following rout is added in xs-app.json under the module ui5workflowproject-approuter, Not under the module ui5applicationmodule .
Step 4 , Test from deployed sapui5 application
https://sap-internal—p-t-cee-iacapj-dev-ui5workflowproject-approuter.cfapps.eu10.hana.ondemand.com/ui5applicationmodule/index.html
Step 5, Check the result in Cloud Process Integration
The End!
Thank you for your time for reading!
Best regards!
Jacky Liu
Cool blog post Jacky !!
Hello Jacky Lui,
I am also trying to access CPI endpoint from Busniess application studio ,
we have created destination as well with basic auth , we are not able see that destinatio fro BAS
also if we are trying to access the CPI endpoint we are facing CORB security issue
do you have any idea how to handle it ?
thanks in advance !
Hello Jacky Lui,
I am also facing the same issue
could you help
Thank you.
Pritee
Hi Jacky Liu,
Have you tried doing the same process with a managed app-router application instead of the standalone as you have used in your case?
Thanks,
Rajat Jain
Hi,Rajat, Jain,
I have not tried that. If we can use postman to test the api, it means we can use Ajax to call the API . If we need to test a managed App-router, we need to figure out the API URL , User account first .
Best regards!
Jacky Liu