-
1. Re: REST interface for JBPM
kukeltje Mar 17, 2010 8:18 AM (in response to jump)Would be nice if you could write a blog post about this.
Curious though why you used jaxb for a rest interface... jaxb=xml, rest!=xml right?
-
2. Re: REST interface for JBPM
swiderski.maciej Mar 17, 2010 9:08 AM (in response to jump)BPM Console has a REST interface as well, with JSON thou but perhaps you have the different functionality at your interface.
Either way could be interesting to see what you have developed.
Cheers,
Maciej
-
3. Re: REST interface for JBPM
jump Mar 17, 2010 9:41 AM (in response to jump)I used JAXB-annotated classes to wrap JBPM classes and interfaces. I also tryed castor mapping and apache cxf, but they didn fit. So, I used JAXB to serialize JBPM object to xml and Jersey to bind JBPM services to certain URLs. I attached sources, but removed jbpm.jar & jdbc driver from lib directory (to reduce archive size to 15M). Looking for Bazaar repository.-
jbpm-rest.zip 14.5 MB
-
-
4. Re: REST interface for JBPM
jump Mar 17, 2010 9:49 AM (in response to swiderski.maciej)Would you please give me link to any description of BPM Console's REST interface? Cause I actually missed it hope my work was not useless!
Don't be 2 strict! I'm still working on it -
5. Re: REST interface for JBPM
swiderski.maciej Mar 17, 2010 10:33 AM (in response to jump)it is deployed as part of gwt-console-server application, so URL assuming that it is on your local machine and default port for JBoss AS it will be:
http://localhost:8080/gwt-console-server
Once you enter that URL you will get a page with a link to entire description of available URIs. It is located (if I remember correctly) at:
http://localhost:8080/gwt-console-server/rs/server/resources
Cheers
Maciej
-
6. Re: REST interface for JBPM
kukeltje Mar 17, 2010 12:57 PM (in response to jump)Ahhh.. ok, jaxb for the responses etc... cool... Personally (that is me, not the jBPM project) I like this way of doing it. In fact I even thought of doing this directly on the real jBPM services... (why not?) Not everybody doing (j)BPM needs or wants to run a full console to be able to do rest.
Keep up this good work... I personally am certainly interested.
Cheers,
Ronald
-
7. Re: REST interface for JBPM
jump Mar 18, 2010 8:15 AM (in response to jump)By the way, I've shared code at Lounchpad
http://bazaar.launchpad.net/~alexei-tarnakin/+junk/jbpm-rest/files
project is not totally portable (there are still several easy to resolve dependencies in eclipse's project files), but I gonna fix it.
So, the idea is to represent JBPM as a hypermedia. For example, I got repository service at URL http://localhost:8080/jbpm-rest/repo/ and if I wanna get available process definitions, I had to acceess URL http://localhost:8080/jbpm-rest/repo/definitions. The result will be like
<definitionList> <processDefinitions> <id>Order-1</id> <key>Order</key> <name>Order</name> <version>1</version> <suspended>false</suspended> <deployment ref="http://localhost:8080/jbpm-rest/repo/deployment/1"/> </processDefinitions> </definitionList>
as you can see, there is a hypermedia reference to another service http://localhost:8080/jbpm-rest/repo/deployment/1 . If you try to access this URL you will get something like
<deployment> <id>1</id> <state>active</state> <timestamp>0</timestamp> </deployment>
and so on. For example, task has reference to corresponding execution, execution to process definition.
Now I got 3 services (execution, repository, task) & aprox. 20 resolvable URLs. My next step will be to add remaining services. And then I gonna add servlet filters for retrieving actor & group information from request attributes and for unwrapping references i.e. for link like http://localhost:8080/jbpm-rest/repo/definitions?unwrap the result should be like
<definitionList> <processDefinitions> <id>Order-1</id> <key>Order</key> <name>Order</name> <version>1</version> <suspended>false</suspended> <deployment> <id>1</id> <state>active</state> <timestamp>0</timestamp> </deployment> </processDefinitions> </definitionList>
-
8. Re: REST interface for JBPM
jump Mar 25, 2010 12:46 PM (in response to jump)I've added unwrapping filter. Time to create small wiki, I guess.
Can anybody tell me how to remove xml namespaces & prefixes in a proper way (i.e. not a regexp way)?
-
9. Re: REST interface for JBPM
jump Mar 27, 2010 4:24 PM (in response to jump)GET http://hostname/jbpm-rest/task/{id}
So, currently supportet URLs
Repository service
GET http://hostname/jbpm-rest/repo/definitions - list of available process definitions
GET http://hostname/jbpm-rest/repo/definition/{id} - definition identified by id
GET http://hostname/jbpm-rest/repo/deployments - list of available deployments
GET http://hostname/jbpm-rest/repo/deployment/{id} - deployment identified by id
POST http://hostname/jbpm-rest/repo/deploy - accepts multipart/form-data i.e. file from <input type="file" ... />
Execution service
GET http://hostname/jbpm-rest/exec/execution/{id}
GET http://hostname/jbpm-rest/exec/execution/{id}/variableNames
GET http://hostname/jbpm-rest/exec/execution/{id}/variable/{variableName}
POST http://hostname/jbpm-rest/exec/execution/{id}/variables - accepts application/x-www-form-urlencoded where variables represented as key-value pairs. You can modify or add variables to execution by means of this method
GET http://hostname/jbpm-rest/exec/process/{id}
POST http://hostname/jbpm-rest/exec/process/{processDefinitionId}/start - starts process with variables accepted by means of key-value pairs, just the same as POST http://hostname/jbpm-rest/exec/execution/{id}/variables
GET http://hostname/jbpm-rest/exec/process/{processDefinitionId}/start - starts process without any variables attached
POST http://hostname/jbpm-rest/exec/process/{processDefinitionId}/start - ends process with state passed by form param named state
GET http://hostname/jbpm-rest/exec/processes
Managment service
GET http://hostname/jbpm-rest/mgmt/job/{jobId}/execute
GET http://hostname/jbpm-rest/mgmt/jobs
GET http://hostname/jbpm-rest/mgmt/job/forProcessInstance/{processInstanceId}
Task service
GET http://hostname/jbpm-rest/tasks/personal/{userId}
GET http://hostname/jbpm-rest/tasks/group/{groupId}
GET http://hostname/jbpm-rest/task/{id}
GET http://hostname/jbpm-rest/task/{id}/outcomes
GET http://hostname/jbpm-rest/task/{id}/variableNames
GET http://hostname/jbpm-rest/task/{id}/variable/{variableName}
POST http://hostname/jbpm-rest/task/{id}/variables
GET http://hostname/jbpm-rest/task/{id}/comments
POST http://hostname/jbpm-rest/task/{id}/end/{outcome} - ends task with given outcome and parameters passed by key-value pairs
History service
not implemented yet but wrapping classes already done.
You can also add unwrap path param to force replacement of hypermedia links with actual values without additional http requests.
So, I got several questions:
What do you think about proper way to add jbpm user & groups to requests? I was going to pass them as request attributes, but not sure, cause I'm not too good in JBPM4 identitity model.
And the second question, if anybody knows how to remove namespaces & prefixes from JAXB-generated xml?
P.S. Sorry for my poor english (it's not my native, as you can see from profile ), but I'm ready to clear any misunderstands
-
10. Re: REST interface for JBPM
jump Apr 2, 2010 3:50 AM (in response to jump)Namespace & prefixes cleanup added
-
11. Re: REST interface for JBPM
koen.aers Apr 2, 2010 11:56 AM (in response to jump)Alexei,
It would be good if you could document this a bit more on a wiki page. I think that it probably would be valuable to include it somewhere in our codebase.
Cheers,
Koen
-
12. Re: REST interface for JBPM
jump Apr 2, 2010 5:18 PM (in response to koen.aers)I've never been writing wiki before, so I hope somebody will help me (at least to make my english better a little bit ) . So here is my article http://community.jboss.org/wiki/RESTinterfaceforJBPMwithJAXBJersey
-
13. Re: REST interface for JBPM
jump Jul 8, 2010 7:34 AM (in response to jump)Up!
Need ur feedback 4 future improvements
-
14. Re: REST interface for JBPM
jump Jul 20, 2010 8:52 AM (in response to jump)Identity service added & LDAP IdentitySession (if anybody cares )