In my flow i set variable operation as :payload.operation then in Consume node i want to get it’s value
Variable value is set corectly
I also include xml of my flow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:netsuite="http://www.mulesoft.org/schema/mule/netsuite" xmlns:wsc="http://www.mulesoft.org/schema/mule/wsc"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/wsc http://www.mulesoft.org/schema/mule/wsc/current/mule-wsc.xsd
http://www.mulesoft.org/schema/mule/netsuite http://www.mulesoft.org/schema/mule/netsuite/current/mule-netsuite.xsd">
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="a532976e-413b-4f47-bc8f-3e79e6de1417" >
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<db:config name="Database_Config" doc:name="Database Config" doc:id="276e5d43-bd49-4a82-b7c6-934288334aca" >
<db:my-sql-connection host="mudb.learn.mulesoft.com" port="3306" user="mule" password="mule" database="training" />
</db:config>
<wsc:config name="Web_Service_Consumer_Config" doc:name="Web Service Consumer Config" doc:id="a5692620-4f26-4b11-be70-b822710d6c0d" >
<wsc:connection wsdlLocation="http://dneonline.com/calculator.asmx?WSDL" service="Calculator" port="CalculatorSoap12" soapVersion="SOAP12" address="http://www.dneonline.com/calculator.asmx"/>
</wsc:config>
<flow name="api-accountsFlow" doc:id="7a942ae2-4422-46ba-b57d-38bd37ec9f82" >
<http:listener doc:name="Get Accounts Listener" doc:id="a1873bcc-b9f1-4cf7-a405-a1c835cdf69c" config-ref="HTTP_Listener_config" path="/calculator" />
<choice doc:name="Choice" doc:id="0b885797-7da1-4932-9183-869b5a670943" >
<when expression='#[payload.operation=="Add" or payload.operation=="Subtract" or payload.operation=="Mul" or payload.operation=="Divide"]'>
<set-variable value="#[payload.operation]" doc:name="Set Variable" doc:id="5c4da028-7ae8-43e6-ac35-84de6c3b4666" variableName="operation" />
<ee:transform doc:name="Transform JSON Request to XML" doc:id="86f3eebe-0050-4800-9c08-7167ded759d9" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/xml
ns ns0 http://tempuri.org/
---
{
("ns0#" ++ vars.operation): {
ns0#intA: payload.val1,
ns0#intB: payload.val2
}
}
]]></ee:set-payload>
</ee:message>
</ee:transform>
<wsc:consume doc:name="Consume" doc:id="091e6ca8-a78d-4a6f-b947-679235f7bfa4" config-ref="Web_Service_Consumer_Config" operation="#[vars.operation]"/>
<ee:transform doc:name="Transform JSON Request to XML1" doc:id="6b77fd85-8af7-4f96-a299-2b64445ede0b" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload
]]></ee:set-payload>
</ee:message>
</ee:transform>
</when>
<otherwise >
<logger level="INFO" doc:name="Logger" doc:id="b4a8341c-a265-4c60-ab58-9b42d899c8fd" />
<set-payload value="=== Operation Not Found ===" doc:name="Set Payload" doc:id="f8436921-0612-44b5-b12d-7dac7bfd7c2d" />
</otherwise>
</choice>
</flow>
</mule>
When i run my flow i get org.mule.runtime.module.extension.internal.runtime.ValueResolvingException: Unable to resolve value for the parameter: operation at org.mule.runtime.module.extension.internal.runtime.operation.OperationParameterValueResolver.getParameterValue(OperationParameterValueResolver.java:101) at org.mule.runtime.module.extension.internal.metadata.MetadataMediator.getMetadataKeyObjectValue(MetadataMediator.java:426) at org.mule.runtime.module.extension.internal.metadata.MetadataMediator.getMetadata(MetadataMediator.java:181) at org.mule.runtime.module.extension.internal.runtime.ExtensionComponent.lambda$getMetadata$21(ExtensionComponent.java:656) at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:224) at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:1102) at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:1020)