Book a demo

← Documentation

REST-XML Connector Guide

Guide layout

The REST XML connector guide includes the following topics:

  • Create a REST-XML asset: a detailed step-by-step tutorial on how to create a REST-XML module and assets.
  • Connector properties: a list of all the connector properties and their explanations.
  • Connector runtime behavior: a short description of the connector role on runtime.
  • Configure the XML Parser: a detailed explanation on how to enable the XML parser to identify XML entity types.

Create REST-XML module and assets

To create a REST-XML asset, perform the following steps.

Step 1. Before you start

Before you start creating the rest xml module, make sure that you have at your disposal:

  • XML data source files from which to generate asset metadata files.
  • An optional XML parser configurator YAML file to enable the parser to identify the type of XML entities.

Step 2. Create a REST-XML module

First, create the REST-XML module:

> ol create module rest-xml-module --connector rest-xml
$ ol create module rest-xml-module --connector rest-xml

Step 3. View the properties of the REST-XML connector

After you created your connector module you can learn what properties you need to populate in order to continue creating the asset. For more information on the REST-XML connection properties, see Properties below.

  1. Navigate to the module folder

    > cd rest-xml-module
    
    $ cd rest-xml-module
    
  2. From under the module directory, display the help menu of the ol add command:

    [module-name]> ol add --help
    
    [module-name]$ ol add --help
    

REST-XML Connector Guide screenshot The ol add help menu displays the connector property list:

> ol add --help
Usage: ol add [OPTIONS]

  Add Asset to Module metadata

Options:
  --verbose                              Enables verbose mode
  --verbose-debug                        Enables debug mode
  --verbose-trace                        Enables trace mode
  --additional VALUE                     Additional properties
  --xml-file-path TEXT                   Define path to the input (request) XML file
  --xml-out-file-path TEXT               Define path to the output (response) XML file
  --operation-name TEXT                  Define name for this operation
  --http-method TEXT                     Define an HTTP method to call
  --xml-parser-config TEXT               Define path to the XML Parser configuration .yaml file
  --request-url TEXT                     Define a request URL to call
  --host TEXT                            Define host name (required)
  --http-protocol-version TEXT           HTTP Protocol Version. Available values: HTTP_1_0, HTTP_1_1, HTTP_2. Default value: HTTP_1_1
  --use-alpn TEXT                        Set to 'true' when Application-Layer Protocol Negotiation should be used
  --user TEXT                            Provide username to access the server
  --password TEXT                        Provide password to access the server
  --is-trust-self-signed TEXT            Specify if the HTTP client will trust self signed certificates (default: false)
  --timeout TEXT                         Sets the time in milliseconds before the client will drop the request. Setting zero or a negative value
                                         disables the timeout (default: 30000)
  --headers VALUE                        Provide request headers
  --format TEXT                          [JSON, XML] (default: XML)
  --decimal-separator TEXT               (default: .)
  --client-certificate TEXT
  --client-private-key TEXT
  --generate-null-elements TEXT          (default: false)
  --auth-type TEXT                       [NONE, BASIC, OAUTH2] (default: NONE)
  --header-propagation.enabled TEXT      enables http headers propagation (default: false)
  --header-propagation.headers TEXT      List of headers to propagate
  --truststore.pems TEXT                 Provide list of pems
  --escape-strategy.escape-letters TEXT  List of additional characters to escape when building xml request.
  --oauth2.token-host TEXT
  --oauth2.token-endpoint TEXT
  --oauth2.client-id TEXT
  --oauth2.client-secret TEXT
  --oauth2.body-client-credentials TEXT  (default: false)
  --oauth2.grant-type TEXT               [CLIENT_CREDENTIALS, AUTHORIZATION_CODE, RESOURCE_OWNER_PASSWORD_CREDENTIALS, IMPLICIT] (default:
                                         CLIENT_CREDENTIALS)
  --oauth2.scope TEXT
  --oauth2.additional-headers VALUE
  --oauth2.additional-body VALUE
  --profile TEXT                         Configuration profile
  -h, --help                             Show this message and exit

Step 4. Test the connection to the remote server

Run the ol test connection command with the --host property to verify that the data source is accessible and that the connection properties are correct.

[module-name]> ol test connection --host https://run.mocky.io/
[module-name]$ ol test connection --host https://run.mocky.io/

Step 5. Add an asset to the REST-XML module

After you have verified the connection parameters, you can create the asset. The ol add command specifies the properties required for activating the business operation of the server and the XML local source files from which to create the asset metadata. To learn more about each property, see Properties below.

The ol add command adds the asset folder inside the module directory. The folder contains the asset configuration file ([asset-name].json) and the asset testing resources.

[module-name]> ol add --xml-file-path ../xml_ex/call1.in.xml --xml-out-file-path ../xml_ex/call1.out.xml --verbose --xml-parser-config ../xml_ex/ol-fis-xml.yml --operation-name call1 --request-url /v3/215985c7-d586-4ad6-afb6-0853560b1226 --http-method post
[module-name]$ ol add --xml-file-path ../xml_ex/call1.in.xml --xml-out-file-path ../xml_ex/call1.out.xml --verbose --xml-parser-config ../xml_ex/ol-fis-xml.yml --operation-name call1 --request-url /v3/215985c7-d586-4ad6-afb6-0853560b1226 --http-method post

Step 6. Test the REST-XML asset

Test the asset you added to verify that you can request and receive actual business data from the data source.

  1. From your module folder root go to assets/[asset-name]/test_data/case1/:
[module-name]> cd assets/[asset-name]/test_data/case1/
[module-name]$ cd assets/[asset-name]/test_data/case1/
  1. To specify the test input data open in.json:
    case-1> notepad in.json
    
    case-1$ notepad in.json
    

in.json contains the information sent to the remote business operation. It consists of the input keys and values that the business operation requires. This is a random example of an in.json file:

{
  "dfhcommarea" : {
    "custId" : "",
    "creditCards" : [ {
      "cardNumber" : "",
      "cardType" : "",
      "cardLimit" : 0,
      "cardUsage" : 0
    }, {
      "cardNumber" : "",
      "cardType" : "",
      "cardLimit" : 0,
      "cardUsage" : 0
    }, {
      "cardNumber" : "",
      "cardType" : "",
      "cardLimit" : 0,
      "cardUsage" : 0
    }]
  }
}
  1. In in.json, type the values of the input properties. In the example above, type the value 412-83254 for the custId key. see

  2. Now you are ready to run ol test asset:

    [module-name]> ol test asset call1
    
    [module-name]$ > ol test asset call1
    

Properties

--xml-file-path (required)

The local path to the input data source XML file

--xml-file-path ../xml_ex/call1.in.xml

--xml-out-file-path

If the input metadata structure of the input XML is different than its output structure, specify the local location of the output XML.

--xml-out-file-path ../xml_ex/call1.out.xml

--xml-parser-config

The path to the XML Parser configuration YAML file. The YAML file extends the parser capability to process specific XML trees by mapping XML elements to types (e.g., primitives, structures collections, and data types).

--xml-parser-config ../xml_ex/ol-fis-xml.yml

--operation-name

The name of the asset. If --operation-name is not provided, the asset name is identical to the XML source file name.

--operation-name call1

--request-url

The request URL path of the business operation. The complete URL to the server is constructed by the following pattern: host + request-url. --request-url is required when the module includes more than one asset, each having an endpoint of its own, e.g., https://api.host.com/pets and https://api.host.com/users.

--request-url /v3/215985c7-d586-4ad6-afb6-0853560b1226

--http-method

The HTTP method of the operation HTTP request. If --http-method is not provided, the default HTTP method is POST.

--http-method get

--host (required)

The remote data source server address

--host https://run.mocky.io/

--profile

The connection profile of ol add or ol test connection (see: Connection Profiles).

--profile dev

Runtime behavior

The REST-XML connector receives a data request from the data consumer, converts it to XML, and transfers it via an HTTP request to the data source endpoint. The Data Source sends back its data response in an XML format. The connector parses the response and converts it to JSON before sending it to the data consumer.

Configure the XML Parser

When the REST XML connector parses XML files, it cannot infer from the XML tag whether it represents a collection or a structure. To get this information, the parser refers to a YAML file that maps XML entities to their type definition.

For the YAML file format (type attributes, types, primitives, structures, collections) and a full example, see Configure the XML Connector Parser.

Read more

Tell us about yourself

You've been browsing the catalog. Leave your details to keep exploring.

Privacy policy