Of course if you use a recent version of NetBeans or Eclipse, the proxy code generation can be done via some GUI based wizards. This description shows how it is done from the command line using Apache Axis.
The following steps were executed to generate the webservice proxy code:
cd \src java -cp "C:\axis-1_4\lib\*;" org.apache.axis.wsdl.WSDL2Java https://api.fleetmanager.com/FMAPIService/FleetManagerAPI.asmx?wsdlThis step generated some source files into C:\src\ie\bluetree\FleetManagerAPI.
You can download the java SampleClient application from here:
Sample application
To execute the sampleclient please install axis and java as described above. (You do not need to generate the proxy code, it is included in the zip file.). Extract the zip file into a dir. From now on we'll assume that you extracted it into c:\src\. You should see 3 batchfiles in c:\src\java-sampleclient, namely build.bat, clean.bat and run.bat. Execute build.bat, the console should print:
C:\src\java-sampleclient>javac -cp "C:\axis-1_4\lib\*;ie\bluetree\FleetManagerAP I\*;" ie\bluetree\FleetmanagerAPI\*.java ie\bluetree\SampleClient\*.java Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.If you call run now, you'll see the list of commands the sampleclient supports. E.g. if you got the username smith and password bla, then this is how you can retrieve gps readings:
run getGPSReadings smith blaYou should see an output similar to this:
C:\src\java-sampleclient>java -cp "C:\axis-1_4\lib\*;ie\bluetree\FleetManagerAPI \*;ie\bluetree\Sampleclient\*;" ie.bluetree.SampleClient.SampleClient getGPSRead ings HeylTruckLines truckLink - Unable to find required classes (javax.activation.DataHandler and javax.mail.i nternet.MimeMultipart). Attachment support is disabled. numofrows 1000 lastRecordTimestamp 2012-05-09 04:13:09Z lastVehicleID 12 lastLatitude 46.2024916666667 lastLongitude -119.077778333333 numofrows 1007 lastRecordTimestamp 2012-05-09 10:04:14Z lastVehicleID 6 lastLatitude 41.82127 lastLongitude -97.4646066666667 numofrows 655 lastRecordTimestamp 2012-05-09 13:26:23Z lastVehicleID 4 lastLatitude 38.1542333333333 lastLongitude -88.9153883333333 No more data, sleeping for a minute before trying againIf you pass in the wrong username or password, this is what you'll see this in the console (now I passed in a as usn and b as password):
C:\src\java-sampleclient>java -cp "C:\axis-1_4\lib\*;ie\bluetree\FleetManagerAPI \*;ie\bluetree\Sampleclient\*;" ie.bluetree.SampleClient.SampleClient getGPSRead ings a b - Unable to find required classes (javax.activation.DataHandler and javax.mail.i nternet.MimeMultipart). Attachment support is disabled. java.lang.Exception: [Authentication error][USN: a][2012-05-09T13:24:35] at ie.bluetree.SampleClient.SampleClient.handleWebserviceError(SampleCli ent.java:204) at ie.bluetree.SampleClient.SampleClient.getGPSReadings(SampleClient.jav a:101) at ie.bluetree.SampleClient.SampleClient.main(SampleClient.java:32)Please note the string "[Authentication error][USN: a][2012-05-09T13:24:35]" in the error message, this is what was returned by the webservice.
Please see the source code for comments/suggestions about implementation details.