question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot configure Http-Connector headers using element templates

See original GitHub issue

The Map type is required to configure headers in HTTP connectors (cf. this example):

<camunda:connector>
  <camunda:connectorId>http-connector</camunda:connectorId>
  <camunda:inputOutput>

    <camunda:inputParameter name="url">
      http://feiertage.jarmedia.de/api/?jahr=2014&amp;nur_land=BE
    </camunda:inputParameter>

    <camunda:inputParameter name="method">
      GET
    </camunda:inputParameter>

    <camunda:inputParameter name="headers">
      <map>
        <entry key="Accept">
          application/json
        </entry>
      </map>
    </camunda:inputParameter>

    <camunda:outputParameter name="isHoliday">
      <camunda:script scriptFormat="Javascript" resource="parseHoliday.js" />
    </camunda:outputParameter>
  </camunda:inputOutput>
</camunda:connector>

Since element templates are not supporting Map as an input type we cannot create headers for http-connector. For example:

{
            "label": "headers",
	    "type": "Hidden",
            "editable": false,
            "value": {
		 "Content-Type" : "application/json"
	    },
            "binding": {
              "type": "camunda:inputParameter",
              "name": "headers"
            }
          }

or this

{
            "label": "headers",
	    "type": "Hidden",
            "editable": false,
            "value": "{'Content-Type':'application/json'}'",
            "binding": {
              "type": "camunda:inputParameter",
              "name": "headers"
            }
          }

is not working. Because of this i thing that element templates for connectors are useless in this form without support for Map.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:6
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
adrianrieplcommented, Jan 6, 2020

You can actually do Script & Script Format:

Here an example for the input parameter payload for the http-connector:

{
   "label": "Payload",
   "type": "Text",
   "value": "var requestBody = {\n \"to\": execution.getVariable(\"to\"),\n \"body\": execution.getVariable(\"body\"),\n \"subject\": execution.getVariable(\"subject\")\n}; \n\nJSON.stringify(requestBody);",
   "binding": {
      "type": "camunda:inputParameter",
      "name": "payload",
      "source": "var requestBody = {\n \"to\": execution.getVariable(\"to\"),\n \"body\": execution.getVariable(\"body\"),\n \"subject\": execution.getVariable(\"subject\")\n}; \n\nJSON.stringify(requestBody);",
      "scriptFormat": "JavaScript"
   }
}

Or here the example from the samples for an output parameter as script:

{
   "label": "Response",
   "type": "String",
   "value": "wsResponse",
   "binding": {
      "type": "camunda:outputParameter",
      "source": "${S(response)}",
      "scriptFormat": "freemarker"
   }
}
0reactions
philcolbourncommented, Apr 9, 2021

I hoped to hack this by using scopes inside a scope somehow…

I also tries adding <camunda:map><camunda:entry key='Accept'>application/json</camunda:entry></camunda:map> to headers value

no good.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP Connector Knowledge Base Master page
This page serves as the master index page for the HTTP Connector related knowledge articles.
Read more >
Element Template inputParameter default ype "list" - Modeler
Cannot configure Http-Connector headers using element templates. The Map type is required to configure headers in HTTP connectors (cf.
Read more >
HTTPConnector | CloverDX 5.17.0 Documentation
Set up a parameter that has a different name from the field name in the metadata. It enables usage of parameters having names...
Read more >
How do you configure HTTP connector attributes when using ...
However in Spring Boot this settings can't easily be configured with application properties. What is the best way to configure attributes like ...
Read more >
HTTPS Connector Setup - FormAssembly Resource Center
The HTTPS connector currently cannot pass data as JSON content, only as form encoded data. This connector is particularly useful in two different...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found