-
1. Re: how to assign Authentication token to REST Service Task
swiderski.maciej Oct 2, 2014 2:05 AM (in response to aha001)jbpm REST work item handler accepts only BASIC and FORM based authentication so you need to configure handler accordingly. I am afraid there is no support for tokens.
HTH
-
2. Re: how to assign Authentication token to REST Service Task
aha001 Oct 5, 2014 4:22 PM (in response to swiderski.maciej)Thanks Maciej,
I created a custom REST WorkItemahandler. Then
(1) copy the jar to [jbpm]/standalone/deployments/business-central.war/WEB-INF/lib
(2) add "CustomREST": new com.developer.CustomRestWorkItemHandler() to [jbpm]/standalone/deployments/business-central.war/WEB-INF/classes/META-INFCustomWorkItemHandlers.conf
(3) create a new project in workbench
(4) navigate to src/main/resources/META-INF/ and upload CustomWorkItem.wid file
import org.drools.core.process.core.datatype.impl.type.StringDataType;
import org.drools.core.process.core.datatype.impl.type.ObjectDataType;
import org.drools.core.process.core.datatype.impl.type.BooleanDataType;
[
[
"name" : "CustomREST",
"parameters" : [
"Url" : new StringDataType(),
"Method" : new StringDataType(),
"Body" : new StringDataType(),
"ConnectTimeout" : new StringDataType(),
"ReadTimeout" : new StringDataType(),
"Username" : new StringDataType(),
"Password" : new StringDataType(),
"ContentType" : new StringDataType(),
"Authorization" : new StringDataType(),
"IgnoreSSL" : new BooleanDataType()
],
"results" : [
"Result" : new ObjectDataType(),
],
"displayName" : "CustomREST",
"icon" : "icons/restlogo.png"
]
]
(5) create a new "Business Process".
From the process designer in the palette on the left in "Service Tasks" the activity should appear CustomREST, but for some reason I can't see this icon. Can you please advise if I missed out any configuration? Thanks.
-
3. Re: how to assign Authentication token to REST Service Task
swiderski.maciej Oct 7, 2014 3:13 AM (in response to aha001)it could be that the icon is not found and thus not showing on palette. Could you try to use the default icon as it used by default here.
HTH
-
4. Re: how to assign Authentication token to REST Service Task
iiq374 Oct 7, 2014 11:03 PM (in response to swiderski.maciej)Surely there should be a way to set HTTP Headers generally?
It's pretty common for things to be needed in the header as well or instead of the JSON Body.
-
5. Re: how to assign Authentication token to REST Service Task
swiderski.maciej Oct 8, 2014 1:31 AM (in response to iiq374)it does allow to set some headers like content type etc but does not support any header to be set. If you see this as valuable addition feel free to drop feature request jira for it.
HTH
-
6. Re: how to assign Authentication token to REST Service Task
aha001 Oct 12, 2014 8:43 PM (in response to swiderski.maciej) -
7. Re: how to assign Authentication token to REST Service Task
smcco321 Jun 28, 2019 7:47 AM (in response to swiderski.maciej)Hi Maciej,
I believe I'm hitting this same issue running version 7 of Business Central (7.21.0.Final). Is Rest token support still not available in v7?
Thanks.
-
8. Re: how to assign Authentication token to REST Service Task
ndass Feb 4, 2020 11:01 AM (in response to smcco321)I have been able to set the in REST service task using the "Headers" attribute in 7.32.
Attribute name: Headers
Data type: String
Value:
x-txn-correlation-id=test123;Authorization=Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjMI6arZ3Y922BhjWgQzWXcXNrz0ogtVhfEd2o
Attribute name is case sensitive and multiple headers are separated by ";" and name value pair has "=" between it.
Hope this helps.