Making Get and POST REST call directly from BPM

4.4k Views Asked by At

I am working on integration of two different products using REST API. I wanted to know if there is any ready made method available or provided by any other toolkit for making directly REST and POST call. Moreover, json response I am getting is huge. Is there any simpler method available to parse it.

2

There are 2 best solutions below

0
On

For the POST related part of your question, please see my answer to this other thread: https://stackoverflow.com/a/34738613/2526920

For the GET Request you can use the teamworks.HTTP client from a Java Integration Service, as 'newbie' also mentioned in the linked thread.

For the JSON Parsing, as far as I know there is no simple way right now to parse JSON into a IBM BPM Business Object. There seems to be a toolkit with helper methods, but it is only for BPM 8.0.1 and 8.5.0 and I have never tested it: https://developer.ibm.com/bpm/blog/resources/json-helper-toolkit/

0
On

Our company has a REST toolkit available for IBM BPM Process Designer that will allow you to make REST calls without having to do significant data marshaling / marshaling. It will parse data into / out of business objects for either XML or JSON based REST Calls. Doing this in a generic manner took several man months of work. If you only have a few rest calls you may look at writing a simple java integration to help you.

Note that if you have pure JSON I believe you can turn it into a JS data structure by doing an "eval" on it, then parse the resulting JS object into a business object. This can be dangerous however as it leads to the possibility of injection attacks. The code would look something like -

var myJSObject = eval(tw.local.jsonString);
tw.local.targetObject = tw.object.targetType.new();
tw.local.targetObject.someField = myJSObject.someField;
//and so on.