Package net.ionite.docval.server
Class DocValHttpClient
- java.lang.Object
-
- net.ionite.docval.server.DocValHttpClient
-
public class DocValHttpClient extends Object
A client to the ion-docval server- Author:
- Ionite
-
-
Constructor Summary
Constructors Constructor Description DocValHttpClient()
Construct a client with a default server URI: http://localhost:35791/api/validateDocValHttpClient(String uri)
Construct a client with the given server URI
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidationResult
validate(byte[] documentData)
Send the given XML document to the server for validation, using a keyword derived from the document (seeKeywordDeriver
for more information on keyword derivation).ValidationResult
validate(byte[] documentData, String keyword)
Send the given XML document to the server for validation, using the given keyword.
-
-
-
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 (seeKeywordDeriver
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 validatekeyword
- 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.
-
-