How to create a process to request a simple REST webservice and display its JSON response ?

Hi there,

I’m trying to create a very simple process to request a REST webservice with an URL path of type :

 http://localhost:8080/myService/{entity}/{id}

where {entity} is the mandatory type of data searched (also defined on the BDM) and {id} is the optionnal id of an object of type {entity} (if not filled, all object of type {entity} are returned).

The response returned by the webservice is a JSON containing a list of {entity} objects.
{entity} are simple maps of “key”/“value” (both strings) with known structure.

I’d like the process to have 3 basic steps :
1- a form to ask user for {entity} and {id} values (for the first attemt, only one {entity} type is known)
2- a task to request the webservice with parameters filled previously (probably throw a dedicated connector ? i’ve tried to make one but can’t test it, always get a puzzling exception)
3- another form to show result as a table (for the first attempt only one {entity} type is known and shown, the final aim is to managed each {entity} type known by the webservice)

(Bonita BPM 7.1.x, Community edition)

This sounds like a very generic and simple process, but I’ve already spent many time and can’t make it work…

  • I’ve searched here and everywhere in the documentation, nothing helps : the only rest sample i’ve found with rest webservice is made for 6.x version and don’t use contracts and ui designer, and/or have a dedicated “groovy” scripts that can’t be reused elsewhere…
  • “Debug” running mode don’t seems to do anything (break point in connector not break). where is the documentation for thi debug mode ?

… Can anyone help me please ???

1 Like

Hi,

You’re not far off but there is a slightly easier way which we use…

Process is as follows:

1- a form to ask user for {entity} and {id} values
(the form is designed as follows: row 1 entity:?? and id:?? fields, row 2: Button “Get Data”, row 3 (an empty DIV id=myTableData) )

2- User enters data, clicks on button

3- Button fired JavaScript to AJAX call to get the data and update the empty DIV with a datatable that you can now use…

document.getElementById(“myTableData”).innerHTML = “my returned JSON (which I’ve formatted)”;

This previous post of mine sort of tells what to work with but doesn’t fix exactly, that’s your job :slight_smile:

http://community.bonitasoft.com/node/22070#node-22071

regards
Seán

PS: If this reply answers your question, please mark a resolved.

Hi Sean,

Thanks for your answer.

I’m not sure about your solution (i’m a rooky at javascript, and dont really understood your previous post…).

By the way, i’ve simplified intentionnaly the processus in order to train with bonita BPM, but the real purpose is more complex. The “real” rest web service is actually a “CRUD” of very complex data structures.

My final need with bonita will be to simplify some complex data structure manipulation for user : the process get some data from distinct entities with the rest service, extract few fields of some structures to aggregate them in a simpler way for final user. This user could update the field values and then my process will update each data from his original structure, calling back the update request of the rest service.

So, i’m not sure your “div” viewer would do the job.

My “first attempt” test process is to get only one structure from the rest service a display it, but the data must be available to be updated in the next process steps…

Not sure if i’m clear enough ?

Very clear, and yes my “example” was only a pointer to something that would help. Sounds like you’ve got a real challenge on your hands…

I’ll read it again and see what I can come up with…

regards
Seán

A real challenge, that’s exactly it !.. ^^

Above all, I’m totally beginner with BPM in general and Bonita BPM in particular… I’ve already peeled a great part of documentation, tutorial, webinars, and so on, but I still not feel very qualified with all the BPM concepts…

Any help would be deeply appreciated.

Thanks and regards
JM

Can you share your process via dropbox or something similar, looks like you’ve done most everything…

regards
Seán

Hi Sean,
I’ve uploaded the exported .bos here :
http://s000.tinyupload.com/index.php?file_id=71168156284587696938

Thanks,
JM

The problem looks like the field “message” in BDM DataManager.

I think this might be one of those funny unknown, known reserved words.

Try calling the field MsgReturn or MessageReturned,

regards
Seán