Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page details the steps necessary to create a SOAP client, using eclipse, that is able to communicate with the holiday web service.

1.  Create a new project using eclipse

2.  Go to Run Configurations

  • a.  Under Java Applications -> main tab
    • i.  Set main class to: org.apache.axis.wsdl.WSDL2Java
    • ii.  Set Project to whatever project you created
    • iii.  Set name to whatever name you want.
  • b.  Under Java Applications -> arguments tab
  • c.  Under Java Applications -> classpath tab
    • i.  Add in latest jars for:
      • activation.jar
      • axis.jar
      • commons-discovery.jar
      • commons-logging.jar
      • commons-net.jar
      • jaxrpc.jar
      • jaxrpc-api.jar
      • mail.jar
      • saaj.jar
      • wsdl4j.jar
        • (also add these jars to the buildpath, these jars are available in the misint -> holidayWebService repository in the HolidayServiceClient Project)

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 methodIMPORTANT NOTE: THE BEHAVIOR BELOW IS DEPRECATED

In order to communicate with the Holiday Web Service via REST, the url of the web method must be according to these guidelines.

The base url for the REST controller (on the test server) is [https://www.hawaii.edu/its/ws/holiday/rest]

From there the name of the method is appended onto the url Ex. /exists, /closest, /inMonth, /inYear, /inRange

The name of the method is followed by a '?' and then the parameters separated by '&'.

Ex. https://www.hawaii.edu/its/ws/holiday/rest/closest?date=2012-01-01&isObserved=true

Supported methods:

For all methods that require the full date the format must be yyyy-MM-dd, even if the day or month is a single digit it must be preceded by a 0, Ex. 01, 02, etc.

Only the parameters concerning the date are necessary all other parameters are optional, however any boolean values will default to true if not specified.

  • boolean isObserved - Used to indicate if the user is referring to the date the holiday is observed (true), or the official date (false).
  • boolean searchForward - Used by closest method to search forward if true or backwards if false.
  • boolean includeStartAndEnd - Used by inRange method to decide if the search should include the start and end dates.
  • String type - An optional parameter through which the user can select which type of Holiday should be returned (Federal, Bank, UH, State)

exists(date, isObserved, type) - Returns whether the given date is a holiday or not.
Ex. https://www.hawaii.edu/its/ws/holiday/rest/exists?date=2012-01-02&isObserved=true&type=Federal

closest(date, searchForward, isObserved, type) - Returns the closest holiday to the given date.
Ex. https://www.hawaii.edu/its/ws/holiday/rest/closest?date=2012-01-10&searchForward=true

inMonth(month, year, isObserved, type) - Returns all holidays within the given month. The year parameter is optional and will default to the current year if not specified.
Ex. https://www.hawaii.edu/its/ws/holiday/rest/inMonth?month=03&type=state

inYear(year, isObserved, type) - Returns all holidays within the given year.
Ex. https://www.hawaii.edu/its/ws/holiday/rest/inYear?year=2012

inRange(beginDate, endDate, includeStartAndEnd, isObserved, type) - Returns all holidays within the range.
Ex. https://www.hawaii.edu/its/ws/holiday/rest/inRange?beginDate=2012-01-27&endDate=2012-06-29&includeStartAndEnd=true