XML Modules

The folder TBox XEngines->XML in the Standard subset contains Modules that perform specific tasks for the XML Engine 3.0.

The XML folder contains the additional Modules Request transformation and Response transformation. These Modules perform background tasks for Modules that you use for your tests. You cannot use them in TestCases.

The XML folder also contains a sub-folder named Encryption with additional Modules (see chapter "Folder Encryption").

XSD Validation

The Module XSD Validation allows you to validate an XML file against an XSD (see chapter "Validating XML structures using XSD").

It has the following ModuleAttributes:

ModuleAttribute

Description

Path to XML

Full path to the XML file.

Use ActionMode Select.

Path to XSD

Full path to the XSD file.

Use ActionMode Select.

In this example, you validate the XML file books.xml against the XML schema books.xsd.

{CP[ExampleDirectoryXML]} refers to the file path you defined in the test configuration parameter ExampleDirectoryXML.

XSD validation

Get XML from Connection

The Module Get XML from Connection allows you to create an XML resource from an existing file resource (see chapter "Open XML resources").

It has the following ModuleAttributes:

ModuleAttribute

Description

ConnectionResource

Name of the existing resource.

XmlResource

Name of the resource that you want to create from the existing resource.

In this example, you create a resource from an existing resource.

  • In the first TestStep, you load user.xml into the resource FileResource.

  • In the second TestStep, you write the content of FileResource to NewResource.

Use an existing resource

Save XML file

The Module Save XML file allows you to transfer the modifications you made to the resource to the connected XML file (see chapter "Save XML files").

It has the following ModuleAttributes:

ModuleAttribute

Description

Resource

Name of the resource.

Filepath

Full path to the XML file where you want to save the content of the resource.

This ModuleAttribute is optional. Use it if you want to save to a different file than the file from which the resource was loaded.

Use BOM

Specify whether you want to use a byte order mark (BOM) at the beginning of the XML file. To do so, enter True.

This ModuleAttribute is optional.

In this example, you save the content of the resource xmlResource to the file books.xml. This file is located at C:\Temp.

You use a byte order mark (BOM) at the beginning of the XML file.

Save an XML file

Open/Create XML file

The Module Open/Create XML file allows you to perform one of the following actions (see chapter "Open XML resources"):

  • Create a new XML file.

  • Load an existing file as a Resource.

It has the following ModuleAttributes:

ModuleAttribute

Description

Resource

Specify a name for the resource.

Use ActionMode Select.

Filepath

Full path to the file.

Use ActionMode Select.

In this example, you load the file books.xml into the resource SampleResource.

{CP[ExampleDirectoryXML]} refers to the file path you defined in the test configuration parameter ExampleDirectoryXML.

Load an XML file

Create XML Resource

The Module Create XML Resource allows you to create an empty XML resource (see chapter "Open XML resources").

It has the following ModuleAttribute:

ModuleAttribute

Description

Resource

Specify a name for the resource.

In this example, you create the empty resource xmlResource.

Create an empty resource

For an example of how to add elements to this resource, see chapter "Adding elements".

Sign XML Resource

The Module Sign XML Resource allows you to create an XML signature.

It has the following ModuleAttributes:

ModuleAttribute

Description

FromResource

Source Resource of the transformation.

ToResource

Target Resource of the transformation.

Certificate

Choose between the specializations CertificateStoreData and JavaKeyStoreData.

To do so, right-click the TestStepValue and select Implement Specialization from the context menu. In the subsequent dialog box, select a specialization from the drop-down menu and click OK.

Fill out the required TestStepValues (see chapter "CertificateStoreData" and chapter "JavaKeyStoreData").

Signature

Read-only.

Signature->Type

Define the signature type: Enveloped or Enveloping.

Signature->CanonicalizationMethod

Specify a canonicalization method. Possible values are:

  • C14N

  • C14NWithComments

  • None

Signature->DigestMethod

Specify the digest method used to sign the XML. Possible values are:

  • Sha1

  • Sha256

  • Sha512

  • Ripemd160

Signature->IncludeKeyInfo

Specify whether to provide a public key. The recipient of the data can then verify the validity with the corresponding public key.

Possible values are:

  • True: attach the KeyInfo tag to the signature.

  • False: don't attach the KeyInfo tag to the signature.

Signature->ReferenceId

Define a reference ID.

Signature type Enveloped:

  • Value True: the XML Engine 3.0 defines a reference ID for the element to sign.

  • Value False: the XML Engine 3.0 signs the whole document.

Signature type Enveloping:

  • Value True: the XML Engine 3.0 defines a reference ID for the data object in the enveloping signature.

  • Value False: the XML Engine 3.0 generates a reference ID for data object.

XPath

Include or exclude XML elements from signing.

For more information and examples of how to use the Module in TestCases, see chapter "Sign, verify, decrypt, and encrypt resources".

Verify Signed XML Resource

The Module Verify Signed XML Resource allows you to verify a signed XML.

It has the following ModuleAttributes:

ModuleAttribute

Description

FromResource

Source Resource of the transformation.

ToResource

Target Resource of the transformation.

Certificate

Choose between the specializations CertificateStoreData and JavaKeyStoreData.

To do so, right-click the TestStepValue and select Implement Specialization from the context menu. In the subsequent dialog box, select a specialization from the drop-down menu and click OK.

Fill out the required TestStepValues (see chapter "CertificateStoreData" and chapter "JavaKeyStoreData").

If you leave the Attribute empty, the XML Engine 3.0 searches for an embedded key.

ReferenceId

Specify the element ID of the signed element whose signature you want to verify.

If you leave the value empty, the XML Engine 3.0 verifies the whole document.

ExpectedResult

Specify the expected result of the signature verification. Possible values are:

  • Valid

  • Invalid

For more information and examples of how to use the Module in TestCases, see chapter "Sign, verify, decrypt, and encrypt resources".

Verify XML

The Module Verify XML allows you to verify XML resource contents by using DotNet XPath expressions.

It has the following ModuleAttributes:

ModuleAttribute

Description

Resource

Name of the resource.

XPath

Enter a DotNet XPath expression between quotation marks.

If your XPath expression contains the special character ", prefix it with another ".

Content

Enter the expected result and use ActionMode Verify.

For more information and examples of how to use the Module in TestCases, see chapter "Verify contents of XML resources".

Evaluate XPath

The Module Evaluate XPath allows you to evaluate DotNet XPath expressions and to verify or buffer the result.

It has the following ModuleAttributes:

ModuleAttribute

Description

Resource

Name of the resource.

XPathExpression

XPath expression that you want to evaluate.

  • Specify node or attribute values with single quotes.

  • Specify special characters with a leading escape character.

EvaluationResult

Result of the XPath expression. You can verify or buffer the result.

For more information and examples of how to use the Module in TestCases, see chapter "Verify contents of XML resources".