Utils services

Contains utility services.

generateUUID

Generates a random Universally Unique Identifier (UUID).

Input Parameters for generateUUID

None

Output Parameters for generateUUID

  • UUID: String - A randomly generated Universally Unique Identifier (UUID).

createMessageDigest

Generates a message digest for a given message.

Input Parameters for createMessageDigest

  • algorithm: String. Name of the algorithm that you want to use to compute the message digest. Must be one of the following: MD5, SHA-1, SHA-256, SHA-384, or SHA-512.

  • input: byte[]. Optional. Message for which you want the digest generated where the message is in the form of a byte array. If both input and inputAsStream are provided, inputAsStream takes precedence.

  • inputAsStream: java.io.InputStream. Optional. Message for which you want to generate a message digest where the message is in the form of an input stream. If both input and inputAsStream are provided, inputAsStream takes precedence.

Output Parameters for createMessageDigest

  • output: byte[]. Conditional. Computed digest in the form of a byte array. output is returned when the input parameter input is provided.

  • outputAsStream: OutputStream. Conditional. Computed digest in the form of an output stream. outputAsStream is returned when the input parameter inputAsStream is provided.

deepClone

Clones an object using the default Java™ serialization mechanism.

Input Parameters for deepClone

  • originalObject: java.io.Serializable. Object to be cloned.

Output Parameters for deepClone

  • clonedObject: Object. Copy of the originalObject.

transcode

Transcodes data from one encoding to another.

Input Parameters for transcode

  • inputData: Document. Data to be transcoded. Depending on the data type of the source data, use string or bytes variable to specify the data. You must provide input data to string or bytes. If you do not specify input data in either string or bytes, the utils:transcode service ends with an exception. If you specify input data for both string and bytes, the utils:transcode service uses the contents of string, ignoring bytes.

    Key Description
    string String. Optional. String containing the data to convert to another encoding.
    bytes byte[]. Optional. Sequence of bytes to convert to another encoding.
  • sourceEncoding: String. Encoding used for the source data. This must be an encoding supported by the JRE used with webMethods Integration.

  • targetEncoding: String. Encoding to which the source data needs to be transcoded. This must be an encoding supported by the JRE used with webMethods Integration.

  • onTranscoding Error: String. Optional. Specifies the action to take when encountering unmappable characters. When transcoding data from one character set to annother, it is possible that a character in the source encoding cannot be mapped to a character in the target encoding. Specify one of the following:

    • replace to replace an unmappable character with a replacement character. If you select replace, specify a replacement character in replaceWith.

    • ignore to drop any unmappable characters.

    • report to throw a ServiceException if the service encounters any unmappable characters. This is the default.

  • replaceWith: Document. Optional. Character used to replace an unmappable character found during transcoding. Specify a replacement character for characters that cannot be mapped in string or bytes.

    The utils:transcode service uses a replacement character only when onTranscodingError is set to replace.

    If onTranscodingError is set to replace and a replacement character is not specified, the utils:transcode service uses the default replacement character of space (“\u0020”).

    If you specify a replacement character for both string and bytes, the utils:transcode service uses the contents of string, ignoring bytes.

    Key Description
    string String. Optional. The replacement character to use for unmappable characters in the input data.
    bytes byte[]. Optional. The replacement character to use for unmappable characters in the input data.
  • outputAs: String. Optional. The data type to use for the output data. Specify one of the following:

    • string

    • bytes

    If you do not specify a value for outputAs, the utils:transcode service returns the output in the same data type used for inputData. For example, if you supplied the source data to inputData/string, the service returns the target data to the outputData/string output parameter.

  • normalizationForm: String. Optional. The Unicode normalization form to use during transcoding.

    Specify one of the following:

    • none: Indicates that normalization is not done.

    • NFC (Normalization Form C®): Canonical Decomposition, followed by Canonical Composition. This is the default.

    • NFD (Normalization Form D). Canonical Decomposition.

    • NFKC (Normalization Form KC). Compatibility Decomposition, followed by Canonical Composition

    • NFKD (Normalization Form KD) Compatibility Decomposition.

Output Parameters for transcode

  • outputData: Document Transcoded data. The utils.:transcode service returns the transcoded data in outputData/string or outputData/bytes, depending on the value of the outputAs input parameter. If a value was not specified for outputAs, the service returns the transcoded data in the same data type as the supplied input data.
Key Description
string String. Conditional. Transcoded contents of inputData as a String. The utils:transcode service string returns this output parameter if the input data was supplied in inputData/string or outputAs was set to string.
bytes byte[]. Conditional. Transcoded contents of inputData as a byte[]. The utils:transcode service bytes returns this output parameter if the input data was supplied in inputData/bytes or outputAs was set to bytes.