Apache ESME – SAP River Integration
Whenever I get developer access to a new environment, the first thing I do is try and integrate it with Apache Enterprise Social Messaging Environment (ESME) which is a collaboration environment for the enterprise associated with micro-messages and other activity streams content.
I’ve recently been access to the SAP River preview platform and decided to integrate this environment as well. “SAP River” supports lightweight extensions to SAP’s on-premises ERP (enterprise resource planning) software [SOURCE] and is an important part of SAP’s new On-Demand strategy.
To help clarify where River fits into this strategy, I’ve identified where we are on SAP’s new OnDemand Strategy “Map”.
My goal in this very early proof-of-concept was to explore River as a development platform and identify the ease of integrating this platform with other OnDemand tools. Using ESME’s REST API, I quickly set up a custom action to send messages to ESME that reflected status changes in River records.
The following video provides details of the integration and shows how it works in realtime.
Thanks are Due…
I’d like to thank Gigi Read and Juergen Schmerder for giving me access to the River Preview and Ethan Jewett for helping me with the CodeBox coding. Jurgen also responded quickly to my irritating forum posts when I couldn’t find what I needed in the online River documentation.
Building on my POC
If you want to use my POC as the base for your own tests / explorations with River, here are the details.
You will need an ESME token.
- Go to the ESME Cloud instance and create a user or if already have a user, log-in.
- Go to “MyTokens” page
- Create a token.
- Use this token in your River Custom Action.
You will also need a user on the River Preview System.
If you want to get a headstart, I’ve added my test application to the River CodeX “Sample Apps” Project. If you are a member of the Codex Project, you should be able to import the project – perhaps via URL – although I haven’t tried this yet.
Custom Action Code
var urlString = "http://esmecloudserverapache.dickhirsch.staxapps.net/api2/session?token=O1DSZT1U1KZY24KJXE2SNXGBTRECA4MYKT";
var request = $UTILS.http.createRequest(urlString, "POST");
var response = $UTILS.http.sendRequest(request);
var currInput = $CTX.getInput().getRecord();
default xml namespace = $CTX.collection.getDefaultDataNamespace();
var inputXMLData = new XML(currInput.getData());
var fldvalue = inputXMLData.Test1.toString().replace(/\n/g,"");
var uservalue = inputXMLData.field.toString().replace(/\n/g,"");
var custname = inputXMLData.CustomerName.toString().replace(/\n/g,"");
var urlString2 = "http://esmecloudserverapache.dickhirsch.staxapps.net/api2/user/messages?via=SAPRiver&message=User+'"
+ uservalue + "'+has+changed+customer+data+-+the+new+description+is+'" + fldvalue +"' for customer '"+custname + "'";
var request2 = $UTILS.http.createRequest(urlString2, "POST");
var response2 = $UTILS.http.sendRequest(request2);
$UTILS.log.info("response code is "+ response2.getResponseCode());
$UTILS.log.info("6 is " + response2.getBody().split("\n").join(""));