REST API to Upload Model Contain Service Task (HTTP - Connector)

Hallo Folks,

I am using Camunda REST API (embedded-spring-rest) as from https://github.com/camunda/camunda-bpm-examples/tree/master/deployment/embedded-spring-rest to deploy processes. Deploying processes with script tasks done successfully, but the problem is, I could not deploy process models contain service task which implemented by using HTTP-connector.

When I call deployment service ( /deployment/create) , I will get ("ENGINE-09005 Could not parse BPMN process. Errors: * One of the attributes ‘class’, ‘delegateExpression’, ‘type’, or ‘expression’ is mandatory on serviceTask) since I did n’t specify (class or delegateExpression or delegateExpression ) but I used (bpmn2:extensionElements) for http- connector.

I still have these errors even after adding the http-connector dependencies to pom.xml to the embedded-spring-rest application.
Can you please tell whether REST API support deploying a process model contain service task to be implemented by http-connector or not? , or any alternative solution.

Thanking in Advance

Best Regards,

Hi @AlioPro,

How does you process engine configuration look like? Did you add the ConnectProcessEnginePlugin to your process engine configuration 1?

Cheers,
Roman

Hi @roman.smirnov,

I attached it .I have seen ConnectProcessEnginePlugin on Connectors | docs.camunda.org , but I am not sure how to add this plugin in spring configuration file(applicationContext.xml).

I would be much appreciated if you can help me with adding the required bean and it’s properties.

applicationContext.xml (2.5 KB)

Best Regards,

Hi @AlioPro,

See 1 how to add a ProcessEnginePlugin to the SpringProcessEngineConfiguration. In your case you have to add the org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin instead of org.camunda.spin.plugin.impl.SpinProcessEnginePlugin.

Does it help you?

Cheers,
Roman

Hi @roman.smirnov,

Actually, when I add it to the spring configuration file , I get error 404 even for a process model contain only script task.

applicationContext.xml (2.8 KB)

Best Regards,

Hi @AlioPro,

Could you please elaborate on this a bit more in detail? Stack trace?

Cheers,
Roman

Hi @roman.smirnov,

I mean when I did the modification on the spring configuration file then used deployment service to deploy model with service task, I get the following error.

Apache Tomcat/7.0.73 - Error report

HTTP Status 404 - /camunda-quickstart-embedded-spring-rest/deployment/create


type Status report

message /camunda-quickstart-embedded-spring-rest/deployment/create

description The requested resource is not available.


Apache Tomcat/7.0.73

.

Before adding the modification I could deploy a model with script task successfully ,after adding it, I can’t deploy the simple model with script task (have same error HTTP 404).

Best Regards,

Hi @AlioPro,

Could you please share the log of the tomcat?

Cheers,
Roman

Hi @roman.smirnov,

The problem for error HTTP - 404 was because there was a problem with uploading class “org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin” after removing it from .m2 local repository and updated project(reinstall dependencies) , I could upload that model with service task.

Now when I want to start process instance , I get the following error: No connector found for connector id ‘http-connector’.

Best Regards,

logs.txt (29.8 KB)

Hi @AlioPro,

Could you please share the pom.xml?

Cheers,
Roman

Hi @roman.smirnov,

yes sure, I attached it.

Best Regards,

Hi pom.xml (3.4 KB)

Hi @AlioPro,

Could you try to change the dependency from

<dependency>
  <groupId>org.camunda.connect</groupId>
  <artifactId>camunda-connect-http-client</artifactId>
  <scope>provided</scope>
</dependency>

to

<dependency>
  <groupId>org.camunda.connect</groupId>
  <artifactId>camunda-connect-http-client</artifactId>
</dependency>

Remove the <scope>provided</scope> element.

Cheers,
Roman

Hi @roman.smirnov,

Thank you very much for your answers and notes finally all service tasks are finally executed and I get the results on the eclipse console. The last question please, is it possible to get that result by using a REST API?

Best Regards,

Hi @AlioPro,

What kind of results do you want to get by using the REST Api?

Cheers,
Roman

Hi @roman.smirnov,

I want to get variables return by service task( which contain the response of calling a service) and script task.
I think have to use the following in a script task
execution.setVariable('processInstanceVariable', scriptTaskVariable);

After that have to use variable -instance service to return variable values but when I call it, I’ll get empty array.

Best Regards,

Hi @AlioPro,

This could have different reason, why this is the case.

  • With which parameters do you execute the variable-instance query?
  • Have you already tried this1 one?

Cheers,
Roman

Hi @roman.smirnov,

I used the service mentioned in you link and it’s served my needs . Thank you so much for your helping .

Best Regards,