WhereScape RED provides a command line interface called WslMetadataService.exe that allows users to startup a REST based WhereScape Metadata Service. This is the is the underlying REST service which feeds the WhereScape RED Template Engine whenever a template operation is performed. The tool is available in the RED Windows installation directory.
The REST service has the following endpoints:
Options for connecting to the metadata server:
Command | Description |
|---|---|
| Metadata connection options | |
| --meta-dsn | Set metadata DSN |
| --meta-dsn-arch | The architecture of the ODBC DSN. Valid values are 32 and 64. Defaults to 32 if not specified. |
| --meta-con-string | Sset metadata Connection String (if specified, username, password, dsn can be optional) |
| --red-profile | Set Red Profile path |
| --meta-user | Set metadata login username (use OS authentication if omitted) |
| --meta-password) | Set metadata login password (use OS authentication if omitted |
| --meta-schema | Set metadata schema (including trailing dot) |
| --meta-database | Set metadata database |
| --meta-db-type | Set metadata database type, accepted values can be:
|
| --ws-user | Set metadata user name |
| HTTP options | |
| --insecure | Allow connections without authorization |
| --listen-port | Port number to listen on (defaults to first unused from 8080) |
| General options | |
| --help | Produce help message and exit |
| --version | Report version information and exit |
| --log-level | Set log level (0 is very quiet, 9 is very noisy) |
The following example shows a script that allows you to connect to the metadata server and get json data
$ENV:RED_META_DSN=$ENV:WSL_META_DSN
$ENV:RED_META_USER=$ENV:WSL_META_USER
$ENV:RED_META_PWD=$ENV:WSL_META_PWD
$ENV:RED_META_SCHEMA=$ENV:WSL_META_SCHEMA
$ENV:RED_META_DSN_ARCH=$ENV:WSL_META_DSN_ARCH
$ENV:RED_META_CON_STRING=$ENV:WSL_META_CONSTRING
$strCmds = @"
& cmd /k WslMetadataService.exe --insecure --meta-dsn "WSENV~RED_META_DSN~" --meta-user "WSENV~RED_META_USER~" --meta-password "WSENV~RED_META_PWD~" --meta-schema "WSENV~RED_META_SCHEMA~" --meta-db-type 14 --ws-user "REST_API" --log-level 9 --meta-dsn-arch WSENV~RED_META_DSN_ARCH~ --meta-con-string "WSENV~RED_META_CON_STRING~"
"@
start-process powershell -ArgumentList "-noexit -command & Invoke-Command -ScriptBlock {$strCmds}"
Write-Output "1"
Write-Output "WslMetadataService started in separate window"
Write-Output "Use curl from a command window to get json data back from the service."
Write-Output "Examples (replace the 8080 port with the port returned by your service):"
Write-Output "curl http://localhost:8080/objectsById -o c:\temp\out_ALL_OBJECTS.json"
Write-Output "curl http://localhost:8080/objectsByName/load_customer -o c:\temp\out_LOAD_CUSTOMER.json"
Write-Output "curl http://localhost:8080/types -o c:\temp\out_types.json" |