Class DocValHttpClient


  • public class DocValHttpClient
    extends Object
    A client to the ion-docval server
    Author:
    Ionite
    • Constructor Detail

      • DocValHttpClient

        public DocValHttpClient()
        Construct a client with a default server URI: http://localhost:35791/api/validate
      • DocValHttpClient

        public DocValHttpClient​(String uri)
        Construct a client with the given server URI
        Parameters:
        uri - The URI where the ion-docval-server is hosted
    • Method Detail

      • validate

        public ValidationResult validate​(byte[] documentData)
                                  throws DocValClientException
        Send the given XML document to the server for validation, using a keyword derived from the document (see KeywordDeriver for more information on keyword derivation). Parses the server's response into a ValidationResult object.
        Parameters:
        documentData - Byte-array containing the XML document to validate
        Returns:
        ValidationResult The validation result from the server
        Throws:
        DocValClientException - If the server could not be reached, or it did not return a validation result.
      • validate

        public ValidationResult validate​(byte[] documentData,
                                         String keyword)
                                  throws DocValClientException
        Send the given XML document to the server for validation, using the given keyword. Parses the server's response into a ValidationResult object.
        Parameters:
        documentData - Byte-array containing the XML document to validate
        keyword - The keyword the server uses to select which validation to use
        Returns:
        ValidationResult The validation result from the server
        Throws:
        DocValClientException - If the server could not be reached, or it did not return a validation result.