Versions Compared

Key

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

...

/**
 * Simple sample of main method, it queries the web service for the closest observed holiday to January 1st, 2012.
 */
public static void main(String[] args) throws MalformedURLException
{

HolidayService   HolidayService service = new HolidayServiceLocator();
Calendar   Calendar newYears = Calendar.getInstance();

  // Error with Calendar in that if you don't set hours, minutes, and seconds to zero date could be wrong on web service side, leading to wrong queries.
newYears   newYears.set(Calendar.getInstance().get(Calendar.YEAR), Calendar.JANUARY, 1, 0, 0, 0);

try  try
  {
Holiday     Holiday closest = service.getHolidayServicePort().getClosestHoliday(newYears, true, true); String
    String name = closest.getDescription(); assert
    assert("New Year's Day".equals(name));
  }
catch   catch (Exception e)
  {
System     System.out.println(e.toString());
  }
}