Contact Us 1-800-596-4880

evalUrl

evalUrl(url: String, readerInputs: Dictionary<ReaderInput> = {}, inputValues: Dictionary<Any> = {}, configuration: RuntimeExecutionConfiguration = {}): EvalResult

Evaluates the script at the specified URL.

Experimental: This function is an experimental feature that is subject to change or removal from future versions of DataWeave.

Parameters

Name Description

url

Name of the file execute.

readerInputs

Inputs to read and bind to the execution.

inputValues

Inputs to bind directly to the execution.

configuration

The runtime configuration.

Example

This example shows how evalUrl behaves with different inputs.

Source

%dw 2.0
import * from dw::Runtime
var jsonValue = {
  value: '{"name": "Mariano"}' as Binary {encoding: "UTF-8"},
  encoding: "UTF-8",
  properties: {},
  mimeType: "application/json"
}

var Utils = "fun sum(a,b) = a +b"
output application/json
---
{
  "execute_ok" : evalUrl("classpath://org/mule/weave/v2/engine/runtime_evalUrl/example.dwl", {"payload": jsonValue }),
  "execute_ok_withValue" : evalUrl("classpath://org/mule/weave/v2/engine/runtime_evalUrl/example.dwl", {}, {"payload": {name: "Mariano"}})
}

Output

{
   "execute_ok": {
     "success": true,
     "value": "Mariano",
     "logs": [

     ]
   },
   "execute_ok_withValue": {
     "success": true,
     "value": "Mariano",
     "logs": [

     ]
   }
 }