WhereScape RED provides a command line interface called WslMetadataService.exe that allows users to access the metadata service. The tool is available in the RED Windows installation directory, this tool can also be called from Windows scripting languages or from a script added to RED UI.

Options for connecting to the metadata server:

Command

Description

Metadata connection options
--meta-dsnSet metadata DSN
--meta-dsn-archThe architecture of the ODBC DSN. Valid values are 32 and 64. Defaults to 32 if not specified.
--meta-con-stringSset metadata Connection String (if specified, username, password, dsn can be optional)
--red-profileSet Red Profile path
--meta-userSet metadata login username (use OS authentication if omitted)
--meta-password)Set metadata login password (use OS authentication if omitted
--meta-schemaSet metadata schema (including trailing dot)
--meta-databaseSet metadata database
 --meta-db-type

Set metadata database type, accepted values can be:

  • 2: SQL Server
  • 3: DB2
  • 4: Teradata
  • 5: Oracle
  • 14: PostgreSQL
--ws-userSet metadata user name
HTTP options
--insecureAllow connections without authorization
--listen-portPort number to listen on (defaults to first unused from 8080)
General options
--helpProduce help message and exit
--versionReport version information and exit
--log-levelSet 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"





  • No labels