I/O Types

 Table of Contents

Various I/O types are available for use with:

  • Input A
  • Input B
  • Configuration file

With inputs (inputA, inputB, & configuration file) you can use all of the available types.

1. HTTP 

HTTP or HTTPS URIs can be specified and the comparator will try to load the specified file.
This may involve the downloading of additional entities or other resources that are referenced by the specified file.  Examples include:

  • DOCTYPE dtds
  • XML schema files using xsi association
  • General external XML entities referenced in the file
  • Resources specified using the XInclude mechanism

multipart/form-data

To use File I/O with multipart/form-data, set the Content-Type to text/plain:

.....
Content-Disposition: form-data; name="inputA"; Content-Type: text/plain;
http://www.example.com/file1.xml
--boundary

In XML this is represented by setting the type attribute on the I/O element to http. The uri child element is then used to set the HTTP or HTTPS URI.

<inputA type="http">
  <uri>https://www.example.com/file1.xml</uri>
</inputA>

In JSON this is represented by setting the type key to http.  The uri key is then used to set the HTTP or HTTPS URI.                                                

{
 "inputA": {
   "type": "http",
   "uri": "https://www.example.com/file1.xml"
 }
}


2. File 

This type of I/O is only appropriate when the REST service is being run 'on-premise'. For cloud SaaS use-cases please choose an alternative I/O method.

A file path (on the server) can also be used to specify the input, output, and configuration file locations. For example:

multipart/form-data

To use File I/O with multipart/form-data, set the Content-Type to text/plain:

.....
Content-Disposition: form-data; name="inputA"; Content-Type: text/plain;
/Users/exampleUser/Documents/file1.xml
--boundary

In XML this is represented by setting the type attribute on the I/O element to file. The path child element is then used to set the file path on the server.

<inputA type="file">
  <path>/Users/exampleUser/Documents/file1.xml</path>
</inputA>

In JSON this is represented by setting the type key to file. The path key is then used to set the file path on the server.

{
 "inputA": {
   "type": "file",
   "path": "/Users/exampleUser/Documents/file1.xml"
 }
}

3. Strings

Raw XML can be used from multipart/form-data. To specify raw XML use application/xmltext/xml or text/html as the Content-Type of the part, for example:

Content-Type: multipart/form-data; boundary=boundary-id 
Content-Length: number_of_bytes_in_entire_request_body 
--boundary-id 
Content-Disposition: form-data; name="inputA"; Content-Type: application/xml; 
<root><a/></root> 
--boundary-id 
Content-Disposition: form-data; name="inputB"; Content-Type: application/xml; 
<root/> 
--boundary-id

#content .code