A basic framework for connecting to the OpenSRS registry, executing requests and unmarshalling responses into POJOs that can then be consumed in your application.
OpenSRS Java Client and API
Documentation: https://dyanet.com/osrs/
- Configuration of multiple environments, for example,
testandprod - JAXB Marshalling and Unmarshalling of XML and envelopes
- Public certificate for SSL and MD5 signature
- Request and Response model for expansion to other APIs
- A few basic tests
- High-performance Apache HTTPClient
- Checkout the project and build with Maven or download the distribution
- Copy the
configfolder to a folder of your choice - Set the JVM system property
-Dosrs.configproperty in your application to point to this folder - Use the
activeConfig.xmlto point at the active configuration, for example, test or production - Set your OpenSRS key and username in the test and/or production configuration
- From within your application,
- get an instance of the client
OsrsClient.getInstance(false); - create a request object and set its properties
GetBalance req = new GetBalance(); req.setRegistrantIp(null); - read the response
OsrsResponse response = client.sendReceive(req); assertNotNull(response); System.out.println(response); - cast to POJO and read response properties
Balance balance = ((BalanceResponse)response).getBalance();