This page details the steps necessary to create a REST client, using eclipse, that is able to communicate with the holiday web service. For the client I used Jersey, and downloaded the client and core jars here.
1. Create a new project using eclipse
2. Add the Jersey jars to the buildpath.
2. Go to Run Configurations
- a. Add the Jersey jars to the classpath
-
NOTE: When creating a client for the test server it is required that you add the test site's certificate to the keystore as described here,
and then run the project with arguments (In Eclipse these should be added to the VM arguments of your project's run
configuration):
-Djavax.net.ssl.trustStore=/path/to/keystore
-Djavax.net.ssl.trustStorePassword=changeit (default password is changeit)
3. Ensure the web service is running, and then run the project. This should generate the necessary files for creating a client.
PKIX path building error:
IF there is a PKIX path building failed: SunCertPathBuilderException the web services security certificate has not been added to Java's cacerts file (file of trusted websites). This is required as our test servers are using a self-signed certificate which is not viewed as a valid certificate by Java.
Adding the certificate can be done as described here.
This could also be because you are not running the project with the arguments:
-Djavax.net.ssl.trustStore=/path/to/keystore
-Djavax.net.ssl.trustStorePassword=changeit (default password is changeit)
4. Create a main method