This guide is designed for users of the XML Compare REST API. It provides help for the installation and initial setup of the HTTP server and wrapper component that provides the XML Compare REST API. The XML Compare REST service allows you to invoke XML comparisons from a wide range of programming languages and systems.
The JARs for REST are included in the XML Compare (Java) release. They have a suffix indicating the major.minor.patch version, here shown as 10.0.0:
- deltaxml-rest-10.0.0.jar which needs to be kept in the same directory as an XML Compare release.
- deltaxml-rest-client-10.0.0.jar which can work independently and be placed anywhere.
A license file is required to enable the REST service. The file should be called deltaxml-compare-rest.lic and should contain a license feature for 'compare_rest'. The file should also be placed into the XML Compare install directory together with existing jar and license files.
Starting and Stopping the Service
To start the REST service use the following command (adjust heap and stack sizes as needed or to suit the target system) from the install directory. If all is well some lines of debug and information messages will appear as indicated below.
To use the following command-line samples, replace x.y.z with the major.minor.patch version number of your release e.g. deltaxml-rest-10.0.0.jar
$ java -Xmx4g -Xss20m -jar deltaxml-rest-x.y.z.jar Loading pipelines... Apr 12, 2018 10:44:40 AM org.glassfish.grizzly.http.server.NetworkListener start INFO: Started listener bound to [0.0.0.0:8080] Apr 12, 2018 10:44:40 AM org.glassfish.grizzly.http.server.HttpServer start INFO: [HttpServer] Started. XML Compare REST service started, navigate to: http://0.0.0.0:8080/api/xml-compare/v1/pipelines Control-C to stop it...
When using JDK 9.0 or later an additional add-modules argument is required:
$ java -version java version "9.0.4" Java(TM) SE Runtime Environment (build 9.0.4+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
$ java --add-modules java.xml.bind -jar deltaxml-rest-x.y.z.jar Loading pipelines... May 25, 2018 11:27:10 AM org.glassfish.grizzly.http.server.NetworkListener start INFO: Started listener bound to [0.0.0.0:8080] May 25, 2018 11:27:10 AM org.glassfish.grizzly.http.server.HttpServer start INFO: [HttpServer] Started. XML Compare REST service started, navigate to: http://0.0.0.0:8080/api/xml-compare/v1/pipelines Control-C to stop it...
To stop the service use Control-C as indicated or an appropriate operating system command/tool such as 'kill'.
To use HTTPS you will need to generate an SSL Certificate that can be verified with a Certificate Authority's keys that are included in the JDK. We have internally tested and recommend using Let's Encrypt (https://letsencrypt.org), using this guide to import a Let's Encrypt certificate into a Java KeyStore - https://community.letsencrypt.org/t/tutorial-java-keystores-jks-with-lets-encrypt/34754/10
What the guide doesn't tell you is you should also specify a password for the key itself (i.e. using the -destkeypass parameter)
Note: You will need to use the same password for the KeyStore and the Key itself.
When starting up the REST service, use the Java system properties keystore and keypass to specify the location of the KeyStore, and the password for the KeyStore/Key, for example:
java -jar deltaxml-rest-x.y.z.jar -Dkeystore=/Users/exampleUser/rest/keystore.jks -Dkeypass=password
If using Postman to test the API - if you didn't use Let's Encrypt and chose to use a self-signed certificate, you will need to disable "SSL Certificate Verification" in the Postman Settings.
Using the Service
The Postman API development and testing app provides a simple way to test the XML Compare REST API. We provide a Postman Collection to help get you started with the REST API, details on this are included in the Testing Using Postman section of the REST User Guide.
Alternatively we support HATEOAS principles and the service can be explored using a web browser, please start at:
Substitute the scheme (http or https), hostname, and port depending on your setup.
You may have noted that the final part of the URL above is pipelines, details on how pipelines are discovered and used for XML Comparison can be found in the Pipelines and Discovery section of the REST User Guide.
A sample command-line driver that exploits the REST API is also provided. For more detail please see Testing using Sample Command Line Driver.
For "redistribution" customers we have included an additional guide detailing authentication: XML Compare REST Redistribution Info