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

1
+1
-1

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 ???

2 answers

1
0
-1

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 ?

Comments

Submitted by Sean McP on Fri, 01/29/2016 - 16:36

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

Submitted by Riet1939 on Fri, 01/29/2016 - 16:50

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

Submitted by Sean McP on Mon, 02/01/2016 - 10:16

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

regards
Seán

Submitted by Riet1939 on Thu, 02/04/2016 - 09:27

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

Thanks,
JM

Submitted by Sean McP on Thu, 02/04/2016 - 16:25

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

1
0
-1

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 :)

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

regards
Seán

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

Notifications