Wiki Markup |
---|
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 i. Set Program Arguments to: [https://localhost:8443/holidayWebService/services/holiday?wsdl] \-o src (Where the url is the url for the wsdl) 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. Some Problems: 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(); newYears.set(Calendar.getInstance().get(Calendar.YEAR), Calendar.JANUARY, 1); try { Holiday closest = service.getHolidayServicePort().getClosestHoliday(newYears, true, true); Date date = closest.getObservedDate().getTime(); String name = closest.getDescription(); System.out.println(name + ": " + date); } catch (Exception e) { System.out.println(e.toString()); } } 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 i. Set Program Arguments to: [https://localhost:8443/holidayWebService/services/holiday?wsdl] \-o src (Where the url is the url for the wsdl) c. Under Java Applications \-> 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. Some Problems: 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 { Holiday closest = service.getHolidayServicePort().getClosestHoliday(newYears, true, true); String name = closest.getDescription(); assert("New Year's Day".equals(name)); } catch (Exception e) { System.out.println(e.toString()); } } |
Page Comparison
General
Content
Integrations