This is a very short post on installation and command line interface for wsdl2java. I wanted to explore the command line interface and understand the tool more since calling wsdl2java from maven is somewhat magic to me.
Installation
- Download apache-cxf from http://cxf.apache.org/download.html
- Extract .zip file and put location of extracted bin directory in your PATH
E.g. I did the following
export PATH=$PATH:/Library/Apache-CXF/apache-cxf-2.7.7/bin - Try out wsdl2java on command prompt. This should return the usage.
WSDL
- Get hold of the wsdl, in this blog we are using airport-information which is a slightly non-trivial wsdl from http://free-web-services.com/
Generate fully annotated Java code from WSDL
- Run following to generate Java codeThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
macair:airportInfo nj$ wsdl2java airport.wsdl macair:airportInfo nj$ ll total 48 -rw-r--r-- 1 nj staff 21K 10 Nov 19:03 airport.wsdl drwxr-xr-x 3 nj staff 102B 10 Nov 20:38 net macair:airportInfo nj$ tree . ├── airport.wsdl └── net └── webservicex ├── Airport.java ├── AirportHttpGet.java ├── AirportHttpPost.java ├── AirportSoap.java ├── GetAirportInformationByAirportCode.java ├── GetAirportInformationByAirportCodeResponse.java ├── GetAirportInformationByCityOrAirportName.java ├── GetAirportInformationByCityOrAirportNameResponse.java ├── GetAirportInformationByCountry.java ├── GetAirportInformationByCountryResponse.java ├── GetAirportInformationByISOCountryCode.java ├── GetAirportInformationByISOCountryCodeResponse.java ├── ObjectFactory.java └── package-info.java 2 directories, 15 files
More on wsdl2java help can be found online.
In future blogs I plan to use this wsdl and make a proper application out of it to get airport information from around the world, if I get free time ;-)
No comments:
Post a Comment