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 - Jackson 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
Maven Central (from 0.9.4):
<dependency>
<groupId>com.dyanet.osrs</groupId>
<artifactId>osrs-api</artifactId>
<version>0.9.4</version>
</dependency>Requires Java 21+.
- Add the dependency above, or check out the project and build with Maven
- Configuration is a simple
.propertiesfile, selected in this order:-Dosrs.config=<path-or-classpath-resource>— explicit JVM override- the
OSRS_CONFIGenvironment variable, same semantics — convenient for containers and.env-style deployments that export env vars instead of passing-Dflags (for example, mount a secret at/run/secrets/osrs.propertiesandexport OSRS_CONFIG=/run/secrets/osrs.properties) - otherwise
osrs-<env>.propertieson the classpath, where<env>is-Dosrs.env(defaulttest);osrs-test.propertiesandosrs-prod.propertiestemplates ship inosrs-api/src/main/resources
- Set your OpenSRS key and username (
osrs.userName,osrs.key) in the chosen configuration file - 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();
mvn test(ormvn verify) runs the fast, offline unit test suite and enforces a minimum instruction coverage bar via JaCoCo (seeosrs-api/pom.xml)- Tests tagged
integrationexercise the live OpenSRStestregistry over the network and are excluded by default. Run them withmvn verify -Pintegration, pointingOSRS_CONFIGat a private copy ofosrs-test.propertieswith your horizon credentials. Never commit a real key: this repository is public. In CI, run the CI workflow manually (Actions → CI → Run workflow); it uses theOPENSRS_API_KEYsecret, and your key's IP access rules must allow the runner.
Bump the version in both POMs (no -SNAPSHOT) in a PR and merge it to master. The Release
workflow builds, tests, signs and uploads the release to the Sonatype Central Portal, then tags
v<version>. The deployment is validated but not published until a maintainer clicks
Publish at central.sonatype.com → Deployments. See
AGENTS.md for the one-time setup.