AnsweredAssumed Answered

REST API, complete Task with variables

Question asked by pih on Sep 28, 2011
Latest reply on Jun 19, 2012 by mokematt
Hi there,

I'm trying to use the REST API complete PUT request, like so:
PUT /activiti-rest/service/task/734/complete

the example I'm running is the Expense_process.bpmn20.xml which comes with the activiti-engine-examples in

.\activiti-5.7\workspace\activiti-engine-examples\src\main\process\org\activiti\examples\adhoc

on my applications console i see that I am sending the mandatory form attribute "Amount" with a value of 123456, see below.

My understanding of the UserGuide section http://activiti.org/userguide/index.html#formProperties
is that
Amount
would be mapped to a variable named "Amount".

Created PUT request for "http://localhost:8080/activiti-rest/service/task/734/complete"
DEBUG      : .springframework.web.client.RestTemplate:    Writing [{"processDefinitionId":"Amount:123456"}] as "application/json" using [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter@18fc7ca]
DEBUG      : he.commons.httpclient.HttpMethodDirector:    Preemptively sending default basic credentials

Unfortunately, on my activiti console I see HTTP Status code 500

28.09.2011 07:10:54 org.restlet.resource.UniformResource doCatch
WARNUNG: Exception or error caught in resource
org.activiti.engine.ActivitiException: Did not receive the operation parameters
        at org.activiti.rest.api.task.TaskOperationResource.executeTaskOperation(TaskOperationResource.java:64)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:446)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:490)
        at org.restlet.resource.ServerResource.put(ServerResource.java:1139)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:375)
        at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:591)
        at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:299)
        at org.restlet.resource.ServerResource.handle(ServerResource.java:846)
        at org.restlet.resource.Finder.handle(Finder.java:510)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Router.doHandle(Router.java:497)
        at org.restlet.routing.Router.handle(Router.java:737)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:151)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.engine.ChainHelper.handle(ChainHelper.java:111)
        at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:72)
        at org.restlet.Application.handle(Application.java:388)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Router.doHandle(Router.java:497)
        at org.restlet.routing.Router.handle(Router.java:737)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Router.doHandle(Router.java:497)
        at org.restlet.routing.Router.handle(Router.java:737)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.engine.ChainHelper.handle(ChainHelper.java:111)
        at org.restlet.Component.handle(Component.java:387)
        at org.restlet.Server.handle(Server.java:488)
        at org.restlet.engine.ServerHelper.handle(ServerHelper.java:71)
        at org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:150)
        at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1037)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.activiti.engine.ActivitiException: Unknown property used in expression
        at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:55)
        at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.execute(UserTaskActivityBehavior.java:52)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:40)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListener
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:52)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:45)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:44)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:61)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:111)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEn
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:52)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:45)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:326)
        at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:92)
        at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:49)
        at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44)
        at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:37)
        at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.signal(UserTaskActivityBehavior.java:74)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:309)
        at org.activiti.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:149)
        at org.activiti.engine.impl.cmd.CompleteTaskCmd.completeTask(CompleteTaskCmd.java:63)
        at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:57)
        at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:28)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:148)
        at org.activiti.rest.api.task.TaskOperationResource.executeTaskOperation(TaskOperationResource.java:58)
        … 59 more
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'Amount'
        at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
        at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
        at org.activiti.engine.impl.juel.AstComposite.eval(AstComposite.java:34)
        at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
        at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
        at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
        at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
        at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
        at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)
        … 102 more
28.09.2011 07:10:54 org.restlet.engine.log.LogFilter afterHandle
INFO: 2011-09-28        07:10:54        127.0.0.1       gonzo   127.0.0.1       8080    PUT     /activiti-rest/service/task/734/complete        -       500

I've tried renaming the variable to lowercase and redeploy the bar file, but no luck.

Anybody experienced the same behaviour?

Is there a example on how to complete a task via REST with form attributes?

How do others submit variables via REST?

best regards,
Holger

Outcomes