Error while parsing JSON output, SPIN/DOM-XML-01009

I have configured a http-connector in camunda modeller and deployed to the engine.
it is by now just a simple 4 step process .
the user gives an input , which is used towards 2 different REST APIs to fetch GDPR related data, and printed out in a summary page.

according to any json interpreter it says both systems reply JSON…
the only difference I can see is that 1 of the systems reply in a structured format.

system 1 . JSON raw :

{“result”:[{“id”:392151,“status”:“provision”,“name”:“multiVpnId”:null}],“size”:1}

system 2 json raw:

[
{
“Ref”: “660578”,
“mainProduct”: {
“name”:
“statusCategory”: “Deactivated”,
“registeredDate”: “2015-04-21 11:11:19”
}
]
}
]

from system 2 I get this error message when I run the task .

An error happened while submitting the task form :
SPIN/DOM-XML-01009 Unable to parse input into DOM document

when I look at the error log in docker I get a ton of data.
an this is the beginning of the 2-300 lines of output from this error
27-Jun-2018 08:12:29.636 SEVERE [http-nio-8080-exec-6] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: SPIN/DOM-XML-01009 Unable to parse input into DOM document
org.camunda.spin.xml.SpinXmlDataFormatException: SPIN/DOM-XML-01009 Unable to parse input into DOM document
at org.camunda.spin.impl.xml.dom.DomXmlLogger.unableToParseInput(DomXmlLogger.java:70)
at org.camunda.spin.impl.xml.dom.format.DomXmlDataFormatReader.readInput(DomXmlDataFormatReader.java:51)
at org.camunda.spin.impl.xml.dom.format.DomXmlDataFormatReader.readInput(DomXmlDataFormatReader.java:32)
at org.camunda.spin.impl.SpinFactoryImpl.createSpinFromReader(SpinFactoryImpl.java:155)
at org.camunda.spin.impl.SpinFactoryImpl.createSpin(SpinFactoryImpl.java:69)
at org.camunda.spin.impl.SpinFactoryImpl.createSpinFromReader(SpinFactoryImpl.java:130)
at org.camunda.spin.impl.SpinFactoryImpl.createSpin(SpinFactoryImpl.java:50)
at org.camunda.spin.impl.SpinFactoryImpl.createSpinFromString(SpinFactoryImpl.java:103)
at org.camunda.spin.impl.SpinFactoryImpl.createSpin(SpinFactoryImpl.java:47)
at org.camunda.spin.Spin.S(Spin.java:64)
at jdk.nashorn.internal.scripts.Script$53$^eval_.:program(:1)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)

I’m not a developer, so I had hoped to be able to configure the http-connector in the modeller instead of getting someone to write the connectors in java for me.

is there any setting I can do in the connector to be able to read the “formatted” JSON output from system2 ?

Stringify your Json response before you pass it into spin. If usit’s by Js you can do: S(JSON.stringify(myResponseVar))

Use Json slurper if using groovy

Hi @StephenOTT
thanks . you got me 1 step closer.
but unfortunately not all the way :frowning:

I changed the setting in the http-connector to
S(JSON.stringify(response));
it didn’t like the myResponseVar

a new error occurs
SPIN-01004 No matching data format detected

This is what is logged in the docker container log

04-Jul-2018 20:08:31.114 WARNING [http-nio-8080-exec-5] org.camunda.bpm.engine.rest.exception.ExceptionHandler.toResponse org.camunda.spin.spi.SpinDataFormatException: SPIN-01004 No matching data format detected
at org.camunda.spin.impl.logging.SpinCoreLogger.unrecognizableDataFormatException(SpinCoreLogger.java:53)
at org.camunda.spin.impl.SpinFactoryImpl.createSpinFromReader(SpinFactoryImpl.java:127)
at org.camunda.spin.impl.SpinFactoryImpl.createSpin(SpinFactoryImpl.java:50)
at org.camunda.spin.impl.SpinFactoryImpl.createSpinFromString(SpinFactoryImpl.java:103)
at org.camunda.spin.impl.SpinFactoryImpl.createSpin(SpinFactoryImpl.java:47)
at org.camunda.spin.Spin.S(Spin.java:64)
at jdk.nashorn.internal.scripts.Script$17$^eval_.:program(:1)

I struggle with finding detailed documentation on how to configure the connectors in camunda-modeler, any suggestion ?

See https://medium.com/@stephenrussett/handling-government-business-processes-across-administrative-divisions-digitalstate-406f86d4fd56

Are you sure this is the raw output? Because if so, this seems to be wrong JSON. Note that you have two closing square brackets and only one opening. Using an online pretty print tool resulted in an error due to wrong JSON format.

Can you recheck that?