Apache CXF (http://incubator.apache.org/cxf/) distribution comes with a large set of examples.
However, I did not find one to access a publicly available web service. I have created one:
http://nrsenthil.googlepages.com/wsdl_second.zip
This demo accesses a publicly available wsdl:
http://www.w3schools.com/webservices/tempconvert.asmx?WSDL
To run the wsdl_second demo:
1. Extract the zip file so "wsdl_second" is parallel to the "wsdl_first" that comes with the distribution.
2. connect the PC to the internet
3. Assuming the distribution is extracted to:
C:\apache\apache-cxf-2.0.5-incubator
Execute the command "ant client" at:
C:\apache\apache-cxf-2.0.5-incubator\samples\wsdl_second
You should see a response from the web service, Celcius value for the Farenheit value specified in the file Client.java.
I followed the following steps to run wsdl_first on my Windows XP Professional:
- Download apache-cxf-2.0.5-incubator.zip from http://incubator.apache.org/cxf/download.html
- I used JDK6.
- I used Ant 1.6.5.
- Unzip apache-cxf-2.0.5-incubator.zip (say C:\apache\apache-cxf-2.0.5-incubator\ )
Set all the Windows environment variables as described in:C:\apache\apache-cxf-2.0.5-incubator\samples\README - Create a new directory called endorsed like:
C:\Program Files\Java\jdk1.6.0_05\jre\lib\endorsed - Follow the jdk6 special instruction (http://incubator.apache.org/cxf/apache-cxf-205-incubating-release-notes.html) (If using a Java 6 kit, you may need to copy the jaxb*.jar, saaj*.jar, jaxws*.jar jars from the C:\apache\apache-cxf-2.0.5-incubator\lib dir to your newly created C:\Program Files\Java\jdk1.6.0_05\jre\lib\endorsed directory)
- Open a new cmd window and cd to:
C:\apache\apache-cxf-2.0.5-incubator\samples\java_first_pojoand issue
“ant server”
Open another new cmd window and cd to:
C:\apache\apache-cxf-2.0.5-incubator\samples\java_first_pojoand issue
“ant client”
The client window should now display a greeting message.