Could not resolve function 'S'

I’ve been looking at the SOAP service task example on github.

I’ve changed things around so that instead of the webservicex.net site (which seems to be down for a while now) I’m calling a mock service on SOAPUI.

I’m able to run as a maven install but when I try to deploy on tomcat, I get the following:-

24-Nov-2016 21:25:54.195 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.camunda.bpm.getstarted.lengthconversion.LengthConversionApp
org.camunda.bpm.engine.ProcessEngineException: ENGINE-08043 Exception while performing ‘Deployment of Process Application Length Conversion App’ => 'Deployment of process archive ‘length-conversion’: ENGINE-01009 Error while parsing process
at org.camunda.bpm.container.impl.ContainerIntegrationLogger.exceptionWhilePerformingOperationStep(ContainerIntegrationLogger.java:312)
at org.camunda.bpm.container.impl.spi.DeploymentOperation.execute(DeploymentOperation.java:130)
at org.camunda.bpm.container.impl.jmx.MBeanServiceContainer.executeDeploymentOperation(MBeanServiceContainer.java:156)
at org.camunda.bpm.container.impl.spi.DeploymentOperation$DeploymentOperationBuilder.execute(DeploymentOperation.java:203)
at org.camunda.bpm.container.impl.RuntimeContainerDelegateImpl.deployProcessApplication(RuntimeContainerDelegateImpl.java:88)
at org.camunda.bpm.application.AbstractProcessApplication.deploy(AbstractProcessApplication.java:58)
at org.camunda.bpm.application.impl.ServletProcessApplication.contextInitialized(ServletProcessApplication.java:131)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4810)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.camunda.bpm.engine.ProcessEngineException: ENGINE-01009 Error while parsing process
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseLogger.parsingProcessException(BpmnParseLogger.java:46)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:298)
at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.transformDefinitions(BpmnDeployer.java:100)
at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.transformResource(AbstractDefinitionDeployer.java:91)
at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.parseDefinitionResources(AbstractDefinitionDeployer.java:66)
at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.deploy(AbstractDefinitionDeployer.java:56)
at org.camunda.bpm.engine.impl.persistence.deploy.DeploymentCache$1.call(DeploymentCache.java:69)
at org.camunda.bpm.engine.impl.persistence.deploy.DeploymentCache$1.call(DeploymentCache.java:66)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:553)
at org.camunda.bpm.engine.impl.persistence.deploy.DeploymentCache.deploy(DeploymentCache.java:66)
at org.camunda.bpm.engine.impl.persistence.entity.DeploymentManager.insertDeployment(DeploymentManager.java:52)
at org.camunda.bpm.engine.impl.cmd.DeployCmd.deploy(DeployCmd.java:470)
at org.camunda.bpm.engine.impl.cmd.DeployCmd$1.call(DeployCmd.java:137)
at org.camunda.bpm.engine.impl.cmd.DeployCmd$1.call(DeployCmd.java:126)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:553)
at org.camunda.bpm.engine.impl.cmd.DeployCmd.doExecute(DeployCmd.java:126)
at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:93)
at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:75)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:95)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.camunda.bpm.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:92)
at org.camunda.bpm.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:207)
at org.camunda.bpm.engine.impl.repository.ProcessApplicationDeploymentBuilderImpl.deploy(ProcessApplicationDeploymentBuilderImpl.java:59)
at org.camunda.bpm.container.impl.deployment.DeployProcessArchiveStep.performOperationStep(DeployProcessArchiveStep.java:132)
at org.camunda.bpm.container.impl.spi.DeploymentOperation.execute(DeploymentOperation.java:114)
… 18 more
Caused by: org.camunda.bpm.engine.impl.javax.el.ELException: Could not resolve function ‘S’
at org.camunda.bpm.engine.impl.juel.Tree.bind(Tree.java:122)
at org.camunda.bpm.engine.impl.juel.TreeValueExpression.(TreeValueExpression.java:65)
at org.camunda.bpm.engine.impl.juel.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:428)
at org.camunda.bpm.engine.impl.juel.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:73)
at org.camunda.bpm.engine.impl.el.ExpressionManager.createValueExpression(ExpressionManager.java:77)
at org.camunda.bpm.engine.impl.el.ExpressionManager.createExpression(ExpressionManager.java:72)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseUtil.parseParamValueProvider(BpmnParseUtil.java:208)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseUtil.parseNestedParamValueProvider(BpmnParseUtil.java:153)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseUtil.parseOutputParameterElement(BpmnParseUtil.java:141)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseUtil.parseCamundaOutputParameters(BpmnParseUtil.java:105)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseUtil.parseInputOutput(BpmnParseUtil.java:73)
at org.camunda.connect.plugin.impl.ConnectorParseListener.parseServiceTask(ConnectorParseListener.java:42)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.parseServiceTaskLike(BpmnParse.java:1961)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.parseServiceTask(BpmnParse.java:1916)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.parseActivity(BpmnParse.java:1216)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.parseActivities(BpmnParse.java:1193)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.parseScope(BpmnParse.java:651)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.parseProcess(BpmnParse.java:574)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.parseProcessDefinitions(BpmnParse.java:513)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.parseRootElement(BpmnParse.java:323)
at org.camunda.bpm.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:288)
… 42 more

24-Nov-2016 21:26:15.222 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
24-Nov-2016 21:26:15.222 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()

I’m guessing that this is something to do with execution listeners but I’m stumped after that, any help greatly appreciated.

PS. I’m using Camunda as an embedded engine and the applications run on a full community distribution installed on Tomcat.

You have an invalid bpmn file due to an invalid expression on a task which you defined.

The function S is the one that is inside the service task from the tutorial (output parameter).

The contents of the BPMN file for this area is as follows

	<camunda:inputOutput>
		<camunda:inputParameter name="url">http://JJEC-laptop:8088/mockCurrencyConvertorSoap12</camunda:inputParameter>

		<camunda:inputParameter name="payload">
			<camunda:script scriptFormat="freemarker" resource="soapEnvelope.ftl" />
		</camunda:inputParameter>
			<camunda:inputParameter name="headers">
			<camunda:map>
				<camunda:entry key="Content-Type">application/soap+xml;charset=UTF-8;action="CurrencyConvertor"</camunda:entry>
			</camunda:map>
		</camunda:inputParameter>
		<camunda:outputParameter name="CurrencyConvertor">
			<![CDATA[
			 ${S(response)
				.childElement("Body")
				.childElement("http://JJEC-laptop:8088", "ConversionRateResponse")
				.childElement("ConversionRateResult")
				.textContent()}
			]]>
		</camunda:outputParameter>
	</camunda:inputOutput>

I guess what I need to understand is what is tomcat trying to resolve from this function? Is it matching the elements with the request being sent through in the soapEnvelope.ftl?

What actions can I take to ensure that tomcat is able to accept the WAR file?

Thanks

Not clear if this is understood/known based on your last post: The S() function is the SPIN function which allows you to parse and navigate Json and xml

https://docs.camunda.org/manual/7.5/reference/spin/

Thanks for replying.

Unfortunately, there is no guidance about using SPIN in that link (why childElements, textContent plus what other functions are there?) The question I can see was repeated here as well in the old google groups forum.

What I don’t understand is why should it be throwing up an error on deployment? The text (apart from the content within the parentheses) is exactly the same as that within the github example.

Just using `

`

worked ok, that is I was able to deploy and output was assigned to a process variable, So I then looked at using javascript

Again canabalising another example from github

However this time I got another exception on deployment

01-Dec-2016 21:20:23.566 SEVERE [http-apr-8080-exec-9] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: Unable to evaluate script: ReferenceError: "execution" is not defined in <eval> at line number 2 org.camunda.bpm.engine.ScriptEvaluationException: Unable to evaluate script: ReferenceError: "execution" is not defined in <eval> at line number 2 at org.camunda.bpm.engine.impl.scripting.SourceExecutableScript.evaluateScript(SourceExecutableScript.java:119)
The two examples, I’ve been working from in github have been following the SOAP service examples. What gives?

@theHornet, there are links at the bottom of that page that link to specifics about XML and JSON.

The links point to: https://docs.camunda.org/manual/7.5/reference/spin/xml/
And for example there a whole section about childElements: Manipulating XML | docs.camunda.org.

Can you please post your bpmn file?

Thanks for posting the link

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_B0ppIPFYEeOlke_H2tkzCA" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://camunda.org/examples">
<bpmn:process id="length-conversion" name="Length Convertor" isExecutable="true">
	<bpmn:startEvent id="StartEvent_1" camunda:formKey="embedded:app:forms/length-conversion-form.html">
		<bpmn:outgoing>SequenceFlow_0cxvzjj</bpmn:outgoing>
	</bpmn:startEvent>
	<bpmn:serviceTask id="ServiceTask_19l64pj" name="Convert Measurement (SOAP)">
		<bpmn:extensionElements>
			<camunda:connector>
				<camunda:connectorId>soap-http-connector</camunda:connectorId>


				<camunda:inputOutput>
					<camunda:inputParameter name="url">http://JJEC-laptop:8088/mockCurrencyConvertorSoap12</camunda:inputParameter>

					<camunda:inputParameter name="payload">
						<camunda:script scriptFormat="freemarker" resource="soapEnvelope.ftl" />
					</camunda:inputParameter>

					<camunda:inputParameter name="headers">
						<camunda:map>
							<camunda:entry key="Content-Type">application/soap+xml;charset=UTF-8;action="CurrencyConvertor"</camunda:entry>
						</camunda:map>
					</camunda:inputParameter>
					<camunda:outputParameter name="CurrencyConversion">
									<![CDATA[
										${S(response)
										.childElement("Body")
										.childElement("http://JJEC-laptop:8088", "ConversionRateResponse")
										.childElement("ConversionRateResult")
										.textContent()}
									]]>
					</camunda:outputParameter>
				</camunda:inputOutput>

			</camunda:connector>  


		</bpmn:extensionElements>
		<bpmn:incoming>SequenceFlow_0cxvzjj</bpmn:incoming>
		<bpmn:outgoing>SequenceFlow_023rtic</bpmn:outgoing>
	</bpmn:serviceTask>
	<bpmn:sequenceFlow id="SequenceFlow_023rtic" sourceRef="ServiceTask_19l64pj" targetRef="UserTask_0r1g8qa" />
	<bpmn:userTask id="UserTask_0r1g8qa" name="Display Results" camunda:formKey="embedded:app:forms/display-results.html">
		<bpmn:incoming>SequenceFlow_023rtic</bpmn:incoming>
		<bpmn:outgoing>SequenceFlow_0ws0muo</bpmn:outgoing>
	</bpmn:userTask>
	<bpmn:endEvent id="EndEvent_0o9lkgp">
		<bpmn:incoming>SequenceFlow_0ws0muo</bpmn:incoming>
	</bpmn:endEvent>
	<bpmn:sequenceFlow id="SequenceFlow_0ws0muo" sourceRef="UserTask_0r1g8qa" targetRef="EndEvent_0o9lkgp" />
	<bpmn:sequenceFlow id="SequenceFlow_0cxvzjj" sourceRef="StartEvent_1" targetRef="ServiceTask_19l64pj" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
	<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="length-conversion">
		<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
			<dc:Bounds x="337" y="102" width="36" height="36" />
			<bpmndi:BPMNLabel>
				<dc:Bounds x="310" y="138" width="90" height="20" />
			</bpmndi:BPMNLabel>
		</bpmndi:BPMNShape>
		<bpmndi:BPMNShape id="ServiceTask_19l64pj_di" bpmnElement="ServiceTask_19l64pj">
			<dc:Bounds x="440" y="80" width="100" height="80" />
		</bpmndi:BPMNShape>
		<bpmndi:BPMNEdge id="SequenceFlow_023rtic_di" bpmnElement="SequenceFlow_023rtic">
			<di:waypoint xsi:type="dc:Point" x="540" y="120" />
			<di:waypoint xsi:type="dc:Point" x="608" y="120" />
			<bpmndi:BPMNLabel>
				<dc:Bounds x="529" y="110" width="90" height="20" />
			</bpmndi:BPMNLabel>
		</bpmndi:BPMNEdge>
		<bpmndi:BPMNShape id="UserTask_0r1g8qa_di" bpmnElement="UserTask_0r1g8qa">
			<dc:Bounds x="608" y="80" width="100" height="80" />
		</bpmndi:BPMNShape>
		<bpmndi:BPMNShape id="EndEvent_0o9lkgp_di" bpmnElement="EndEvent_0o9lkgp">
			<dc:Bounds x="757" y="102" width="36" height="36" />
			<bpmndi:BPMNLabel>
				<dc:Bounds x="730" y="138" width="90" height="20" />
			</bpmndi:BPMNLabel>
		</bpmndi:BPMNShape>
		<bpmndi:BPMNEdge id="SequenceFlow_0ws0muo_di" bpmnElement="SequenceFlow_0ws0muo">
			<di:waypoint xsi:type="dc:Point" x="708" y="120" />
			<di:waypoint xsi:type="dc:Point" x="757" y="120" />
			<bpmndi:BPMNLabel>
				<dc:Bounds x="687.5" y="110" width="90" height="20" />
			</bpmndi:BPMNLabel>
		</bpmndi:BPMNEdge>
		<bpmndi:BPMNEdge id="SequenceFlow_0cxvzjj_di" bpmnElement="SequenceFlow_0cxvzjj">
			<di:waypoint xsi:type="dc:Point" x="373" y="120" />
			<di:waypoint xsi:type="dc:Point" x="440" y="120" />
			<bpmndi:BPMNLabel>
				<dc:Bounds x="279.5" y="110" width="90" height="20" />
			</bpmndi:BPMNLabel>
		</bpmndi:BPMNEdge>
	</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>

</bpmn:definitions>

As you can see the output parameter is almost the same apart from the attributes as that used within the github example.

WRT to the link, it was useful thanks, but where does this following go:

import static org.camunda.spin.Spin.XML;

I take it that I can’t put into a BPMN file so where should this be going, isn’t it already covered by this entry in the project’s POM file?

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

	<dependency>
		<groupId>org.camunda.spin</groupId>
		<artifactId>camunda-spin-dataformat-xml-dom</artifactId>
	</dependency>

TYIA

Hi,

If anyone gets the same message, I found that I was missing the reference to org.camunda.spin.plugin.impl.SpinProcessEnginePlugin in my bpm-platform.xml file.

HTH

Anthony

1 Like