The VersaLex Web Service (WS) protocol is used to connect to and transfer files to and from web services.
VersaLex uses Apache Axis2 (version 1.5.1) for SOAP communication and Apache Rampart (version 1.5) for WS-Security. The VersaLexapplication does not, however, support all features contained within Axis2 and Rampart.
- The VersaLex application will read and parse WSDL 1.1, 1.2 or 2.0 from a URI or local file.
- Supports HTTP and HTTP/s transports.
- Injects custom SOAP headers.
- The VersaLex application can send and receive both text and binary files.
- Supports WS-Security profiles.
The VersaLex Web Service protocol does NOT support:
- SOAP Encoding (as specified in SOAP 1.1)
- RESTful web services
The following action commands are available in the VersaLex application:
Command | Purpose | |
---|---|---|
Host commands | CONNECT | Initializes new connection to host if necessary. |
PUT | Send one or more files to the host. | |
PUT+GET | Send a SOAP document and retrieve/save the SOAP response. | |
GET | Receive one or more files from the host. | |
DIR | Retrieve a directory listing; can be used in conjunction with GET to retrieve multiple files. | |
CONFIRM | Confirm a transfer; can be used in conjunction with GET to confirm transfer after successful retrieval. | |
DELETE | Delete a remote file; can be used in conjunction with GET to delete file after successful retrieval. | |
DISCONNECT | Shuts down connection to host if necessary. | |
Local commands | SYSTEM | Execute a local system command |
WAIT | Pause | |
SET | Sets a property | |
CLEAR | Clears a string property | |
LCOPY | Copy one or more local files | |
LDELETE | Delete one or more local files | |
LREPLACE | Replace bytes in one or more local files | |
CHECK | Check for a transfer, file, or directory (VLTrader and Harmony only) | |
SCRIPT | Execute a JavaScript File (VLTrader and Harmony only) |
WS Configuration
WS Host
A host's parameters specify its location and how it is reached.
WS Host: General Tab
- Server Address
- Either a fully qualified name (recommended) or an IP address.
- Port
- You can specify either a specific port number or -1 -1 to indicate the default port specified in the WSDL (usually 80 for HTTP or 443 for HTTP/s).
- Connection Type
- The kind of connection you want to use for this host.
- Forward Proxy
- The address of the forward proxy you want to use for this host.
- Default Directories
- Modify the default directories, if necessary. You can use macro variables from the drop-down lists. See Using Macro Variables for a list of the applicable macros (Default Host Directory context) and example usage. For the Cleo VLTrader and Cleo Harmony application, see URI File System interface overview for information about you can use a Cleo-provided or custom URI for the Inbox and/or Outbox. See Specifying default host directories for information about setting up system-level directories and custom directory macro variables.
Note: If the host has an external association, the default directories might be managed outside of the VersaLex application and not shown here.
- Inbox
- Default directory for incoming files. Enter a value directly or click … to navigate to and select a directory.
- Outbox
- Default directory for outgoing files. Enter a value directly or click … to navigate to and select a directory.
- Sentbox
- If specified, default directory for retaining sent files. Files are a copy of the original source file; any file manipulations performed as part of the send are not reflected in the sentbox copies. Enter a value directly or click … to navigate to and select a directory.
- Receivedbox
- If specified, default directory for retaining received files. Files are a copy of the final destination file; any file manipulations performed as part of the receive are reflected in the receivedbox copies. Enter a value directly or click … to navigate to and select a directory.
WS Host: Web Service Tab
- Transport
- The section is used to specify the transport protocol for connecting to the web service.
- HTTP
- Indicates your web service does not support HTTPs connections.
- HTTP/s
- Indicates your web service supports secure HTTPs connections.
- Resource Path
- The appropriate value is automatically extracted from the WSDL. Use this option to override the WSDL setting.
- WSDL Location File/URL
- The location for the Web Service Description Language (WSDL). Specify a URI to the WSDL or a local file containing the WSDL. The WSDL is a standard XML description of the entry points for your web service. If your service does not have a WSDL, you must create one. Refer to WSDL specification at http://www.w3.org/TR/wsdl.
WS Host: Commands Tab
The Commands tab displays a list of available commands. Each command must be mapped to one or more actual web service method calls. Double-click a command or right-click the row and select Edit from the menu to display the Methods dialog box.
Using the Methods dialog box
Use the Methods dialog box to add, edit, and order method calls to the web service.
- Click Add to display the Edit Method dialog box, where you add a new web service call.
- For existing calls, highlight the entry and click Edit or double-click on the entry to display the Edit Method dialog box, where edit the web service call.
- Highlight and click Delete to remove the method call from the list for the command.
- Use Move Up and Move Down to move the highlighted method up and down in the list, respectively.
Adding or editing methods
Adding or editing the method will display the Edit Method dialog box. Provide information about the method you selected in the fields in the Edit Method dialog box.
- Method
- Choose the method you want to map from the drop-down menu. The menu is populate from methods defined in the WSDL.
- Return Variable
- This field is enabled if the method selected returns a value. Use this field to define a variable to store the result of the method call. Variable names must start and end with
%
. The type of the return data is displayed in parentheses following the Return Variable label. This variable can be used as a parameter input to a subsequent method call. - Success Expression
- An optional expression that, if specified and true, will deem the method call successful. If the expression is false, the call is considered an error and subsequent calls are aborted. See WS Expressions for information about specifying an expression.
- Parameters
- A table that contains the parameters for the selected method as defined by the WSDL. Each line in the table represents one parameter and contains the parameter's name and type, indicates whether the parameter is part of a choice, whether the parameter is required, whether the parameter field is a password field, and the parameter value.
If the WSDL specifies that the parameter part of a choice, no more than one of the choices can be used. If the WSDL has a choice of three items, the Choice column will display 1/3, 2/3, and 3/3 to indicate each item of the group. If the WSDL specifies that the parameter is required, the Reqd field will be selected and disabled. Otherwise, you can check the Reqd field to ensure that the parameter is defined before the method is called. In the value field you can enter a legal value or previously defined variable. Selecting that cell will provide a drop-down with system-recognized variables that match the parameter type.
If the parameter is a complex type or array type, a button is displayed and can be used to invoke another dialog to enter the values for the complex type or array values respectively. See WS Variables for more information about variables. If the field is left blank, then a value can be entered for it at the mailbox and/or action levels. If the field is selected as required then a value must be entered at the mailbox or action levels.
- Incoming File
- The Incoming File section of the dialog box is displayed when the methods are being defined for the GET command. The File Name is used to define the resulting filename for the file to get. This can be an actual file name value or a variable that stores the file name result. The File Data Variable should specify the resulting variable that holds the data to get. System-recognized values will appear in a drop-down box when selecting that field. See WS Variables for more information on specifying variable values. The Continue Expression is an expression which, if specified and true, determines whether to continue making calls for the same file or for subsequent files. If Get File In Blocks is selected on the Advanced tab, then this condition determines whether to continue calling the same method to continue getting blocks for the same file. If Get File In Blocks is cleared, then this condition determines whether there are more files to get and will repeat calling the same method until the condition returns false.
- Incoming Directory
- The Incoming Directory field is displayed when the methods are being defined for the DIR command. The %directoryfiles% is used to define the location of the directory file array when the array is not returned at the top-most level. If the array is at the top-most level, %directoryfiles% is defined in the Return Variable and this field will not be used.
WS Host: Advanced Tab
See Setting advanced host properties for information about how to use and set the properties supported in all protocols. Properties available for WS include:
- Add Mailbox Alias Directory to Inbox
- Appends a subdirectory at the end of the host's configured inbox directory. This allows files received through different mailboxes to be kept separate.
- Add Mailbox Alias Directory to Outbox
- Appends a subdirectory at the end of the host's configured outbox directory. This allows files to be sent through different mailboxes to be kept separate.
- Add Mailbox Alias Directory to Receivedbox
- Appends a subdirectory at the end of the host's configured receivedbox directory. This allows files that have been sent through different mailboxes to be kept separate.
- Add Mailbox Alias Directory to Sentbox
- Appends a subdirectory at the end of the host's configured sentbox directory. This allows files that have been sent through different mailboxes to be kept separate.
- Allow Actions To Run Concurrently
- Normally, actions and host actions within the same host are allowed to run concurrently. You can use this property to not allow actions and host actions to run concurrently.
Note: This is a Cleo Harmony and Cleo VLTrader option.
- Command Retries
- If an error or exception occurs during a command, the number of times the command should be retried.
Note: Command Retries does not apply to exceptions related to TCP/IP or ISDN dial-up connections. This is because dial-up connections are managed by the framework so that they can be shared across actions.
- Connection Timeout
- The amount of time allowed for each read operation.
- Delete Zero Length Files
- Indicates whether files received that are zero-length (<= 5 bytes) should be deleted rather than processed.
- Do Not Send Zero Length Files
- Indicates whether zero length files to be sent to the server should be ignored rather than processed. If the
-DEL
option is being used, any zero length file ignored will also be deleted. - Email On Check Conditions Met
- Send an email notification after running a CHECK command where the overall conditions of the check are met. See Configuring email or execute based on results.
Note: This is a Cleo Harmony and Cleo VLTrader option.
- Email On Check Conditions Not Met
- Send an email notification after running a CHECK command where the overall conditions of the check are not met. See Configuring email or execute based on results.
Note: This is a Cleo Harmony and Cleo VLTrader option.
- Email On Fail
- If an error occurs during a command, email the error condition. See Configuring email or execute on based on results.
- Email On Flag
- If a flagged event occurs, email the event. See Configuring email or execute based on results.
- Email On Repetitive Action Failures
- When "Email On Fail" is enabled and the same failure occurs each time an action is run for a specific host, leaving this option unchecked suppresses emailing of the same alert multiple times. If the same email alert continues to be suppressed after 24 hours, the suppressed email alert will be sent every 24 hours and after every system restart if the failure occurs again. When the failure is resolved an email alert will be sent.
Note: This feature only suppresses multiple emails if the same failure occurs multiple times in a row. Suppression is not maintained across synchronized hosts.
- Email On Successful Copy
- Send an email notification after copying a file using LCOPY. See Configuring email or execute based on results.
- Email On Successful Receive
- Send an email notification after successfully receiving a file. See Configuring email or execute based on results.
- Email On Successful Send
- Send an email notification after successfully sending a file. See Configuring email or execute based on results.
- Execute On Check Conditions Met
- After executing a CHECK command where the overall conditions are met, run a system command. See Configuring email or execute based on results.
Note: This is a Cleo Harmony and Cleo VLTrader option.Note: Note that if multiple files contribute to the conditions being met, and one of the file macros is in the command (e.g., %file%), the system command will be executed repeatedly - once for each file.
- Execute On Check Conditions Not Met
- After executing a CHECK command where the overall conditions are not met, run a system command. See Configuring email or execute based on results.
Note: This is a Cleo Harmony and Cleo VLTrader option.
- Execute On Fail
- If an error occurs during a command, run a system command. See Configuring email or execute based on results.
- Execute On Repetitive Action Failures
-
When Execute On Fail is enabled and the same failure occurs each time an action is run for a specific host, leaving this option unchecked suppresses multiple executions of the Execute On Fail command. If suppression of execution of the command for this failure continues after 24 hours, the suppressed Execute On Fail command will be executed every 24 hours and after a system restart if the failure occurs again. When the failure is resolved, the Execute On Fail command will be executed again. Users must account for this by including the %status% macro variable for the Execute On Fail command (see Using macro variables) and then checking for a success or failure.
Note: This feature only suppresses multiple executions of the Execute On Fail command if the same failure occurs multiple times in a row. Suppression is not maintained across synchronized hosts. - Execute On Successful Copy
- After successfully copying a file using LCOPY, run a system command. This command may be used for post-processing the file. See Configuring email or execute based on results.
- Execute On Successful Receive
- After successfully receiving a file, run a system command. This command may be used for post-processing the file. See Configuring email or execute based on results.
- Execute On Successful Send
- After successfully sending a file, run a system command. This command may be used for post-processing the file. See Configuring email or execute based on results.
- Fixed Record EOL Characters
- End-of-line characters to be inserted and/or deleted.
- Fixed Record Incoming Delete EOL
- If Fixed Record EOL Characters has been specified and Fixed Record Length is greater than 0, indicates to look for and delete EOL characters while receiving a file.
Note: When using FTP ASCII mode, standard EOL characters may already be changing if transferring between Windows and Unix platforms.
- Fixed Record Incoming Insert EOL
- If Fixed Record EOL Characters has been specified and Fixed Record Length is greater than 0, indicates to insert EOL characters while receiving a file.
Fixed Record Incoming Delete EOL and Fixed Record Incoming Insert EOL are mutually exclusive properties.
- Fixed Record Length
- The fixed record length after which end-of-line characters need to be inserted and/or deleted.
- Fixed Record Outgoing Insert EOL
- If Fixed Record EOL Characters has been specified and Fixed Record Length is greater than 0, indicates to insert EOL characters while sending a file.
Note: When using FTP ASCII mode, standard EOL characters may already be changing if transferring between Windows and Unix platforms.
- Get File In Blocks
- Enable this setting if the file is transferred in multiple blocks by calling the same method repeatedly during a GET operation. Disable if the entire file is transferred during a single method call.
- High Priority
- Indicates whether incoming and/or outgoing transfers through the host should be treated as high priority. When both high priority and regular priority transfers are active, the high priority transfers get a larger portion of the available bandwidth. Go to
High Priority Transfers Percentage Available Bandwidth
(defaults to 75). See Other system options for more information.
to set the
- Include Failure In Subject Of Email
- When specified, the exception message will be included in the email that is generated on failure.
Note: If the exception message exceeds 256 characters, it will be truncated.
- LCOPY Archive
- If specified, contains the directory for archiving LCOPY source files.
- Log Individual LCOPY Results To Transfer Logging
- When this option is enabled, a
<send>
and<receive>
result is logged to the transfer log for each file copied.Note: This is a Cleo Harmony and Cleo VLTrader option. - Macro Date Format
- Specifies the date format to be used when the
%date%
macro is used. - Macro Time Format
- Specifies the time format to be used when the
%time%
macro is used. - Maximum Incoming Transfer Rate (kbytes/s)
- Sets the maximum incoming transfer rate in Kbytes (1024 bytes) per second for each mailbox or host. The default value of
0
does not limit the transfer rate. The Maximum Incoming Transfer Rate system setting might also limit the transfer rates. The system Maximum Incoming Transfer Rate value is used unless this setting is more restrictive. For simultaneous transfers, the number of active transfers also affects individual transfer rates. See Advanced system options. - Maximum Outgoing Transfer Rate (kbytes/s)
- Sets the maximum outgoing transfer rate in Kbytes (1024 bytes) per second for each mailbox or host. The default value of
0
does not limit the transfer rate. The system setting might also limit the transfer rates. The system Maximum Outgoing Transfer Rate value is used unless this setting is more restrictive. For simultaneous transfers, the number of active transfers will also affect individual transfer rates. See Advanced system options for more information about Maximum Outgoing Transfer Rate. - Outbox Sort
- Controls the order in which multiple files are transferred for a PUT command. If
System Default
is specified, the value set on the tab takes precedence. ForAlphabetical
ordering, the file extensions are not used to determine the sorted order unless they are needed to make the filenames unique. - Outgoing Insert EOL Between Interchanges
- If
Fixed Record Outgoing Insert EOL
is active, indicates to also insert EOL characters between EDI interchanges while sending the file. - Partner Email Address
- The email address of the trading partner for this trading relationship. When set, this address is automatically used to send your local profile information and/or certificates to your trading partner. See Emailing a profile to your trading partner.
- PGP Compression Algorithm
- Compression method used when OpenPGP packaging (with compression) is requested through the Mailbox Packaging tab. See Configuring mailbox packaging. If
System Default
is specified, the value set on the tab is in effect. - PGP Encryption Algorithm
- Encryption method used when OpenPGP packaging (with encryption) is requested through the Mailbox Packaging tab. See Configuring mailbox packaging. If
System Default
is specified, the value set on the tab takes precedence. - PGP Hash Algorithm
- Signing method used when OpenPGP packaging (with signing) is requested through the Configuring mailbox packaging. If
System Default
is specified, the value set on the tab takes precedence. - PGP Integrity Check
- When OpenPGP encrypting (see Configuring mailbox packaging), include an integrity check on encrypted data. Can be disabled for compatibility with certain OpenPGP implementation.
- PGP Signature Verification
- Indicates whether or not signed inbound PGP messages should verified when inbound OpenPGP packaging is requested through the Mailbox Packaging tab. See Configuring mailbox packaging. In general, this property should be enabled.
- PGP V3 Signature
- Put File Block Size (bytes)
- When Put File In Blocks is enabled, this specifies the maximum size of the data blocks for each method call.
- Put File In Blocks
- Enable this setting if the file is transferred in multiple blocks by calling the same method repeatedly during a PUT operation. Disable if the entire file is transferred during a single method call.
- Reset Connection After Timeout On Response
- When enabled will cause an immediate reset on the socket (instead of a graceful close) when a SocketTimeoutException occurs.
- Retry Delay
- The amount of time (in seconds) before a retry should be attempted.
- Reuse SSL Sessions Across Actions
- If selected, SSL sessions from previous connections to the same destination (address and port number) may be resumed to avoid costly negotiation. If unselected, only SSL sessions used in the current action to the same destination may be resumed. When unselected, a new SSL session is created for the initial command port connection.
- SSL Allow Legacy Renegotiation
- When selected, legacy renegotiation is allowed. If this property is not selected, the extension described in RFC5746 is used for renegotiation and the server must also support this extension. See RFC5746 for a description of the extension and the vulnerability it addresses.
- SSL Cipher
- Indicates a specific cipher to be used with the server for SSL key exchange, encryption, and hashing. If not set, the list of supported ciphers is presented to the server and the server picks one.
- SSL Maximum Protocol Version
- Specifies the maximum protocol version allowed. By default, this field is blank, designating that Cleo Harmony, Cleo VLTrader, or Cleo LexiCom will select the most recent version (currently TLS 1.2).
- SSL Minimum Encryption Key Size
- Specifies the minimum encryption key size allowed when selecting an SSL cipher. To prevent use of low- or medium-strength ciphers, change from the default value of
0
to112
,128
, or256
(depending on the requirement). Note that if this value is set too high, all ciphers are filtered out causing theNo suitable cipher suites are enabled
exception to occur. - SSL Minimum Protocol Version
- Specifies the minimum protocol version allowed. SSL 3.0 is the default value for compatibility with servers that do not support the more recent TLS versions 1.0, 1.1, and 1.2.
- SSL Use Record Splitting
- Indicates whether to use 1/n-1 record splitting in CBC mode as a countermeasure against the Rizzo/Duong BEAST (Browser Exploit Against SSL/TLS) attack against the SSL 3.0 / TLS 1.0 protocol. Must be turned off if the SSL library on the other side of the connection does not support the feature.
- Store Raw Received Message
- When this property is enabled, a copy of the response message is stored in the WS/received directory.
- Store Raw Sent Message
- When this property is enabled, a copy of the outbound message is stored in the HTTP/sent directory.
- Terminate On Fail
- If an error occurs during a command, stop the action.
Note:
Regarding non-CHECK commands: When
Terminate On Fail
is on, if a command fails,Email On Fail
andExecute On Fail
, if set, are processed, and then the action stops. WhenTerminate On Fail
is off, if a command fails,Email On Fail
andExecute On Fail
, if set, are processed, and the action continues.Regarding CHECK commands:
Terminate On Fail
is only honored if theConditionsMet
parameter is set and the result of the CHECK is classified asError
. The CHECK command is only available in the Cleo Harmony and Cleo VLTrader applications. - Unzip Use Path
- Indicates whether or not zip entry paths should be used for LCOPY -UNZIP operations. When enabled, the entry's path is added to the destination path, unless the entry contains an absolute path. In this case, the absolute path is used in place of the destination path.
- Wait For Execute On
- Indicates whether execution should wait for processing to complete within an Execute On Fail, Execute On Successful Copy,Execute On Successful Receive, or Execute On Successful Send command. Note that this option does not apply to native AS400 execution.
- XML Encryption Algorithm
- The method used to encrypt/decrypt files when XML Encryption packaging is requested through the Mailbox Packaging tab. See Configuring mailbox packaging . If
System Default
is specified, the value set on the tab takes precedence. - Zip Comment
- Specifies the comment to be added to the zip archive file in LCOPY -ZIP operations.
- Zip Compression Level
- Controls the level of compression for LCOPY -ZIP operations. If
System Default
is specified, the value set on the takes precedence - Zip Subdirectories Into Individual Zip Files
- Indicates whether or not subdirectories should be bundled for LCOPY –ZIP –REC operations. When enabled, each first-level subdirectory (and all of its descendents) will be bundled together into an individual zip file. The name of this zip file may optionally reflect the subdirectory name if an asterisk (
*
) is placed in the destination path. Any files that are directly off the source root directory will not be copied.
WS Mailbox
A mailbox's parameters allow you access to the host system. Create a new mailbox under the host.
WS Mailbox: Web Service Tab
The following describes configuration of the mailbox Web Service tab.
You use the WS Mailbox Web Service tab to define parameters, both optional and required, that have not been defined on the Web Service Host Commands tab. See WS Command Reference. The parameters are displayed in a tree format, using indentation to show child parameters.
- For each parameter, you can enter a literal value or variable. Valid known variables of the same parameter type are displayed in the drop-down when editing the field.
- Parameters enclosed in square brackets (
[ ]
) are optional. Parameters that are not enclosed in square brackets are required and must be specified on this tab or in the command action. - Parameter names that start with an asterisk (
*
) are password fields and the value displayed will be encoded with asterisks. - Parameter names that start with
$
are attributes to their parent parameter.
WS Mailbox: Headers Tab
Use the mailbox Headers tab to specify any additional custom SOAP headers.
Double-click on an empty line (or right-click and select Edit) to add a new custom SOAP header.
Enter the custom SOAP header in the editor provided. The SOAP header must be valid XML, inserted into the SOAP request as part of every method call.
WS Mailbox: Security Tab
Web Services Security (WS-Security) is a flexible and feature-rich extension to SOAP to apply security to Web services. The protocol specifies how integrity and confidentiality can be enforced on messages and allows communication of various security token formats. Its main focus is the use of XML Signature and XML Encryption to provide end-to-end security. Visit http://www.oasis-open.org/specs/index.php#wssv1.0 for more information.
Use the mailbox Security tab to specify SSL (TCP sub-tab) and WS-Security options (Request and Certificates sub-tabs).
TCP
Use the TCP tab to specify an optional client certificate for TLS over secure TCP/IP. This certificate only needs to be specified for those servers that require that a client certificate be presented during SSL negotiations.
Request
WS-Security options are specified using an XML policy file. Use of a WS-Security policy file allows a wide variety of security options. The most common options have been incorporated into VersaLex as the default policy. The security elements that you are required to provide are most often dictated by the service being connected to. Check with an administrator for required security elements.
If you have your own policy file to use, you can clear Use default policy and enter the location of your policy file in the Custom Policyfield. Otherwise, select Use default policy.
The custom policy is loaded into VersaLex when the settings are saved. To force VersaLex to reload the policy (for example, if changes to the policy have been made), click Reload.
- The timestamp token includes a timestamp for the time the request is created and expires. To include this token in the request, select Send timestamp with requests.
- The username token includes a username and non-encrypted password. To include a username token with the request, enter a username in the username field. A password must also be specified if a username is specified.
Certificates
The Certificates tab is for specifying the signing and encryption certificates. If a signing certificate is specified, then the request is signed. If an encryption certificate is specified, then the request is encrypted. In the VersaLex implementation, if the request is encrypted, it must also be signed.
The Trading Partner's Certificates are those provided by the trading partner.
- The Signing Certificate is used to verify a signature from a request's signed response.
- The Encryption Certificate is used to encrypt the outgoing request. If the encryption certificate is the same as the signing certificate, select Use signing certificate.
- Clicking Browse next to the field will bring up the Select Certificate dialog box. In this dialog box, you can locate the trading partner certificate from the local certificate store.
- The Signing Certificate Alias refers to the certificate used to sign the outgoing request. You must also specify the password associated with this certificate.
- The Encryption Certificate Alias is used for decrypting the incoming encrypted request's response. If the encryption certificate is the same as the signing certificate, selecct Use signing certificate.
If you need more assistance with WS-Security, see the following resources:
http://www.ibm.com/developerworks/webservices/tutorials/ws-understand-web-services4/index.html
http://www.ibm.com/developerworks/java/library/j-jws4/
http://thilinamb.wordpress.com/2009/08/19/ws-security-policy-assymetric-binding-explained/
WS Mailbox: Packaging Tab
See Configuring mailbox packaging for information about payload file packaging.
WS Action
An action's parameters capture a repeatable transaction for your mailbox on the host system.
WS Action: Action Tab
Use the Action tab to configure commands within an action.
See Composing an action and WS Command Reference.
WS Variables
The Web Service protocol utilizes variables both as arguments to methods, and to store the results from method calls. The VersaLexapplication also provides a series of predefined variables that can be used as arguments to methods. The predefined variables in the allsection can also be used in the Custom XML Soap Headers field. See WS Mailbox: Headers Tab.
Predefined Variables
The following predefined standard and web service specific variables are available:
Command | Variable | Type* | Description |
---|---|---|---|
(all) | %inbox% | token | This is the path specified in the Inbox field on the host General tab. |
%outbox% | token | This is the path specified in the Outbox field on the host General tab. | |
%datetime% | dateTime | The date and time that the session started. | |
%date% | date | The date that the session started on. | |
%time% | time | The time that the session started at. | |
%host% | token | Name of the current host. | |
%mailbox% | token | Name of the current mailbox. | |
%index% | Int |
Specifies the usage of a daily host index value. Each host's index is reset to 1 at the beginning of each day. It is incremented by one every time %index% is referenced.
The minimum number of digits in the index string is determined by the Minimum Number Of Macro Index Digits setting on the Options > Other tab. See Other system options |
|
PUT | %sourcefile% | token | Source file name. |
%sourcepath% | token | Path of the source file name. | |
%sourcefilebase% | token | The base portion of the filename (minus the extension) for the source file. | |
%sourcefileext% | token | Just the extension portion of the filename for the source file. | |
%sourcefilelength% | long | The length of the file that is being sent. This is -1 for streams and files where the length cannot be determined. | |
%destination% | token | The value in the destination field for the PUT action command. | |
%filedata% | base64Binary | This is the file data to send. The data will be Base64 encoded. If the file is being sent in blocks (using the Put File In Blocks advanced option), then this holds just a block of data. Otherwise, it holds the entire file or streams worth of data. | |
%filecdata% | string | This is the file data to send as a string. If this variable is specified, file data is converted to a string prior to the method call. This will be encapsulated in the request in <![CDATA[…]]> unless the file already contains CDATA, in which case it will behave like %filedatastring%. | |
%filedatastring% | string | This is the file data to send as a string. If this variable is specified, file data is converted to a string prior to the method call. If the file is sent in blocks, this contains a block of data. | |
%blocksize% | int | This is the size of the block of data in %filedata%, %filecdata%, or %filedatastring% that is being sent. | |
PUT, GET | %blocknumber% | int | When file data is transferred in blocks, this is the current block number being sent or received. This value is zero based, so the first block being sent or received is 0. |
PUT, GET | %filecount% | int | When transferring multiple files, this is the number of files being transferred. For a PUT command, this is the number of files specified in the source field. For a GET command (when used with the -DIR option), this is the number of files returned from the DIR command. |
PUT, GET | %filenumber% | int | When transferring multiple files, this is the current file number of the transfer. This number is 1 based, so the first file transferred is 1. |
GET, DELETE | %directoryfile% | ? | When used with the -DIR option, the DIR command is expected to return an array of values stored in %directoryfiles%. This array is enumerated and each item is assigned to the %directoryfile% variable. The type of the %directoryfile% is the same type of the array returned into the %directoryfiles% variable. |
(special) | %directoryfiles% | This variable is a special variable that is expected to be assigned as part of a result in the DIR command. If this variable is not assigned prior to a GET or DELETE with the -DIR option, an error will result. |
* The type corresponds to an XML schema type.
When available, variables that match the type of a drop-down field will appear as options in the drop down.
Within a session, the return variable of a method can be used as the input to any other method. The return value is stored using the variable that is specified for the method definition. Since a return value can be of any time or an array, each value of the array and complex type is also stored.
Variable names begin and end with % (i.e. %result%).
Arrays
When the return value of a method call is an array, the array is stored in the specified variable. The array's size is stored in a special member "._count". The items in the array can be indexed using brackets.
For example, if the result of a call returns a string array (string[]) and %result% is specified as the variable to store the returned value, the following table illustrates the variable definitions:
Variable | Definition |
---|---|
%result% | Contains the array of values |
%result%._count | An integer stating the number of items in the array. |
%result%[0] | The first item in the array. |
%result%[1] | The second item in the array; the bracketed number is n-1 of the defined item. |
Complex Data Types
When the return value of a method call is an object with a complex data type, the object is stored in the variable; member values can be accessed using a period or full stop to separate the member value from the variable name.
For example, if the result of a call is a data structure similar to the following code structure:
public class FileInfo {
public FileCreds fileCreds;
public int fileSize;
public String fileName;
public String[] fileOwners;
public byte[] fileData;
}
public class FileCreds {
public String userId;
public String password;
public String location;
}
and the return variable name is %result%
, the following table describes the variables contained in the array:
Variable | Definition |
---|---|
%result% |
Contains the complex object |
%result%.fileName |
Access the fileName field of the object |
%result%.fileData |
Access the fileData field of the object |
%result%.fileCreds.userId |
Access the userId field of the object |
For an array of complex objects, dereference the array before specifying the field name. For example, for an array of FileInfo structures: %result%[0].fileName
would access the fileName field of the first item in the array.
Method Input Terms
For method parameters that take a string value, multiple variables and text can be combined to form a term.
For example:
%outbox%%result%.fileName | Combines the outbox path with the filename field of the %result% complex variable. |
%filebase%.dat | Adds ".dat" to the contents of the %filebase% variable. |
Session: %sessionid% | Specifies the session with the value in the %sessionid% variable. |
Method Input Functions
Method input functions are evaluated after all method input terms are resolved.
Function | Description |
---|---|
file(filename) |
The file function looks up the file name specified and replaces the method data with the contents of the file. If the method parameter is expecting an array of bytes (base64Binary), then the file is treated as a binary file. Otherwise, the file is treated as a text file. Example:
|
WS Expressions
Expressions are evaluated by comparing the rendering of each side of the expression using the specified operator.
The following operators are available:
Operator | Description |
---|---|
= | Performs an equality comparison of the string rendering of both sides of the expression. If both terms contain the same string, the expression evaluates to true. |
!= | The inverse of the equality comparison. If both terms are different strings, the expression evaluates to true. |
< | Compares two numeric terms. Both sides must resolve to a numeric value; the expression evaluates to true if the first term is less than the second term. |
<= | Compares two numeric terms. Both sides must resolve to a numeric value; the expression evaluates to true if the first term is less than or equal to the second term. |
> | Compares two numeric terms. Both sides must resolve to a numeric value; the expression evaluates to true if the first term is greater than the second term. |
>= | Compares two numeric terms. Both sides must resolve to a numeric value; the expression evaluates to true if the first term is greater than or equal to the second term. |
HAS | The expression evaluates to true if the string in the first term is contained at all in the second term. |
!HAS | The expression evaluates to true if the string in the first term is NOT contained in the second term. |
- null keyword
- The special term
null
can be entered to compare the variable with the valueNULL
. - Binary Comparisons
-
For binary comparisons, variable values are rendered as hexadecimal strings. The operators that work with string values can be used for these comparisons.
For example, if the variable
%result%
contains two bytes with the value of 255 in each byte, the following expression would return true:%result% = FFFF
- Array Comparisons
-
An array is represented as a string in an expression in the following format:
{term1,term2,term3}
WS Command Reference
CONNECT
Initializes new connection to host, if necessary.
CONNECT name=value,...
- name =value
- WS method parameter=value pairs. The required and optional parameters and headers (and potential values) are identified in the syntax of the host commands for the server. See WS Host: Commands Tab. An optional parameter or header is enclosed in brackets ([...]).
PUT
Send one or more files to the host.
PUT -DEL "source" name=value,...
- –DEL
- If the PUT command is successful, delete local file(s).
- "source"
- Local source path
- Path can be to a filename or to a directory
- You can use
*
and?
, or a regular expression when you specify a filename. See Using wildcards and regular expressions for additional information. - If you specify a relative path, the command uses the default outbox.
- You can use macro variables. See Using macro variables (Source File context) for a list of the applicable macros.
- If the path contains a space, dash (-), comma (,), or equal sign (=), it must be enclosed with double quotes ("...").
- name=value
- WS method parameter=value and header=value pairs
GET
Receive one or more files from the host
GET -DIR -CON -DEL –UNI|-APE "destination" name=value,...
- -DIR
- Receive one or more files from the host
- -CON
- If GET is successful, confirm on host that file received.
- -DEL
- If GET is successful, delete host files.
- –UNI
- Ensure local filename unique
- -APE
- If local filename exists, append to file.
- "destination"
- Destination path.
- Path can be to a filename (unless you use the -DIR option) or to a directory.
- You can use a single
*
within the destination path in conjunction with a canned prefix and/or suffix in the filename. - If you specify a relative path, the command uses the default inbox.
- You can use macro variables. See Using macro variables (Destination File context) for a list of the applicable macros.
- You can use the
%HTTP.header.XXXX%
macro, whereXXXX
references an HTTP header name in the server’s response and is replaced with the header’s value. - If the path contains a space, dash (-), comma (,), or equal sign (=), it must be enclosed with double quotes ("...").
- name=value
- WS method parameter=value and header=value pairs
PUT+GET
Send one or more files to the host and receive one or more files from the host in return.
PUT+GET -DEL –UNI|-APE "source" "destination"
- -DEL
- If the command is successful, delete the local file.
- -UNI
- Ensure the local filename is unique.
- -APE
- If local filename exists, append to existing file.
- "source"
- Local source path
- Path can be to a filename or to a directory
- You can use
*
and?
, or a regular expression when you specify a filename. See Using wildcards and regular expressions for additional information. - If you specify a relative path, the command uses the default outbox.
- You can use macro variables. See Using macro variables (Source File context) for a list of the applicable macros.
- If the path contains a space, dash (-), comma (,), or equal sign (=), it must be enclosed with double quotes ("...").
- "destination"
- Local destination path.
- Path can be to a filename or to a directory.
- If you specify no path or a relative path, the command uses the default inbox.
- One
*
is supported with canned prefix and/or suffix in filename. - You can use macro variables. See Using macro variables (Destination File context) for a list of the applicable macros.
- If the path contains a space, dash (-), comma (,), or equal sign (=), it must be enclosed with double quotes ("...").
DIR
Get a directory listing of available files from the host.
DIR name=value,...
- name =value,...
- WS method parameter=value and header=value pairs
CONFIRM
Confirm the receipt of one or more files on the host.
CONFIRM -DIR name=value,...
- -DIR
- Confirm file(s) received using directory listing from the host.
- name=value
- WS method parameter=value and header=value pairs
DELETE
Delete one or more files on the host.
DELETE -DIR name=value,...
- -DIR
- Delete files using directory listing from the host.
- name=value
- WS method parameter=value and header=value pairs
SYSTEM
Execute a local system command.
SYSTEM "path"
- "path"
- Local command path with arguments.
- If you specify a relative path or no path, the command uses the home directory.
- See Using operating system commands in actions for additional information
SET
Change an action property value. The new value only affects the commands that follow the SET.
SET property=value
- property = value
- Action property and new value
- The property name must have no embedded spaces.
- The value specified remains in effect until it is set again or until the end of action.
- To reset property back to default value (host-level or system-level), specify
SET property
or
SET property=
- To clear a string property, use the CLEAR command
CLEAR
Clear an action property string value. The cleared value only affects the commands that follow the CLEAR.
CLEAR property
- property
- Action property name with no embedded spaces.
WAIT
Pause execution.
WAIT seconds
- Seconds
- Number of seconds to pause.
LCOPY
Copy one or more files locally.
LCOPY –DEL -REC {–UNI|–APE} {-ZIP|-UNZ} "source" "destination"
- -DEL
- If the command is successful, delete the local file.
- -REC
- Recursively search all subdirectories.
- -UNI
- Ensure the copied filename is unique.
- -APE
- Append copied file to existing destination file.
- -ZIP
- Zip all the files into one or more ZIP archive files, depending on the destination specified.
- Specify ZIP comment and compression level through Zip Comment and Zip Compression Level properties. See Setting advanced host properties.
- The ZIP archive files created through the LCOPY command conform to the standard ZIP file format. Visit http://docs.oracle.com/javase/6/docs/api/java/util/zip/package-summary.html. The ZIP file format should not be confused with other popular file compression/archive formats such as GZIP, TAR, RAR, etc. The LCOPY command works only with ZIP-formatted files. In addition to the VersaLex application, there are many other software packages that can read/write ZIP-formatted files, for example, WinZip (Windows), File Roller (Linux), PKZIP and Info-ZIP (Windows/Linux/other Unix).
- In addition to standard ZIP-formatted archives, the VersaLex application also supports password-based AES- encrypted ZIP files (128-bit, 192-bit, and 256-bit). See Cryptographic Services.
- -UNZ
- Unzip the source file(s).
- All source files must be ZIP archive files.
- You cannot use this option with the
-REC
option. - Use ZIP entry paths if Unzip Use Path is set. See Setting advanced host properties.
- The ZIP archive files created through the LCOPY command conform to the standard ZIP file format (reference http://docs.oracle.com/javase/6/docs/api/java/util/zip/package-summary.html). The ZIP file format should not be confused with other popular file compression/archive formats such as GZIP, TAR, RAR, etc. The LCOPY command works only with ZIP-formatted files. In addition to the application, there are many other software packages that can read/write ZIP-formatted files, for example, WinZip (Windows), File Roller (Linux), PKZIP and Info-ZIP (Windows/Linux/other Unix).
- In addition to standard ZIP-formatted archives, the VersaLex application also supports password-based AES- encrypted ZIP files (128-bit, 192-bit, and 256-bit). See Encryption of Zip Files for more information on this capability.
- "source"
- Source path
- Path can be to a filename or to a directory
- You can use
*
and?
, or a regular expression when you specify a filename. See Using wildcards and regular expressions for additional information. - If you specify a relative path, the command uses the default inbox.
- You can use macro variables. See Using macro variables (Source File context) for a list of the applicable macros.
- If the path contains a space, dash (-), comma (,), or equal sign (=), it must be enclosed with double quotes ("...").
- "destination"
- Destination path.
- Path can be to a filename or to a directory.
- If you specify a relative path, the command uses the default inbox.
- You can use macro variables. See Using macro variables (Source File context) for a list of the applicable macros.
- You can use a single
*
within the destination path. In this context, it is not a wildcard. Rather, it is used to substitute a source file name or a source subdirectory name. When*
is used in conjunction with both the-REC
and-ZIP
options, andZip Subdirectories Into Individual Zip Files
is enabled, then*
is substituted with each first-level subdirectory name. When*
is not used for bundling zipped subdirectories, then it is used as a shortcut for the%sourcefilename%
or%srcfilename%
macro. Only one*
is allowed in the destination path. See Setting advanced host properties. - When copying a file without the
-APE
option, or when copying a file with the-APE
option where the destination file does not already exist, a temporary file name is used while the copy operation is taking place. This temporary file is placed in the destination directory. Its name begins with the product name and ends with .tmp. Once the copy completes successfully, the temporary file is renamed to the destination name. - If the path contains a space, dash (-), comma (,), or equal sign (=), it must be enclosed with double quotes ("...").
LDELETE
Delete one or more files locally.
LDELETE "source"
- "source"
- Source path.
- Path can be a filename or a directory.
- You can use
*
and?
, or a regular expression when you specify a filename. See Using wildcards and regular expressions for additional information. - If you specify a relative path, the command uses the default inbox.
- Use of macro variables is supported. See Using macro variables (Source File context) for a list of the applicable macros.
- If the path contains a space, dash (-), comma (,), or equal sign (=), it must be enclosed with double quotes ("...").
LREPLACE
Replace bytes in one or more files locally.
LREPLACE "source" Replace="input bytes" With="output bytes"
- "source"
- Source path.
- Path can be to a filename or to a directory.
- You can use
*
and?
, or a regular expression when you specify a filename. See Using wildcards and regular expressions for additional information. - If you specify a relative path, the command uses the default inbox.
- You can use macro variables. See Using macro variables (Source File context) for a list of the applicable macros.
- If the path contains a space, dash (-), comma (,), or equal sign (=), it must be enclosed with double quotes ("...").
- "input bytes"
- List of bytes to be replaced.
- Comma separated list of byte values (0-255).
- All bytes in comma-separated list must be found in the file in listed sequence in order to be replaced.
- "output bytes"
- List of bytes to be substituted for original
input bytes
.- Comma separated list of byte values (0-255).
- If
With
parameter is omitted, then theinput bytes
are deleted from the file.
CHECK
See CHECK Command for information about this command.
SCRIPT
See SCRIPT command for information about this command.
Comment
# text...
Lines in the action starting with a # character are considered comments and will be ignored when the action executes. Lines starting with # are generally used for documentation purposes.
Comments
0 comments
Please sign in to leave a comment.