Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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 Applciations -> classpath tab
    • i.  Add in latest jars for: (also add these jars to the buildpath)
      • activation.jar
      • axis.jar
      • commons-discovery.jar
      • commons-logging.jar
      • commons-net.jar
      • jaxrpc.jar
      • jaxrpc-api.jar
      • mail.jar
      • saaj.jar
      • wsdl4j.jar

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 then most likely the web services security
certificate has not been added to Java's cacerts file (file of trusted websites).
The solution is described in the below website.http://magicmonster.com/kb/prg/java/ssl/pkix_path_building_failed.html

4.  Create a main method

/**
 * 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 service = new HolidayServiceLocator();
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.set(Calendar.getInstance().get(Calendar.YEAR), Calendar.JANUARY, 1, 0, 0, 0);

try

Unknown macro: { Holiday closest = service.getHolidayServicePort().getClosestHoliday(newYears, true, true); String name = closest.getDescription(); assert("New Year's Day".equals(name)); }

catch (Exception e)

Unknown macro: { System.out.println(e.toString()); }

}

  • No labels