UP | HOME

Developing a Web-service client

A good tutorial can be found in the IBM developerWorks series. We customize it as follows.

  1. Create a Java project ClientWebserviceContainerManagement
  2. Create Ant script file build.xml in parent folder ClientWebserviceContainerManagement:
    <project default="wsimport">
       <target name="wsimport">
          <exec executable="${java.home}/../bin/wsimport">
             <arg line="-keep -s ./src -p de.botzenhart.springws.soapclient
                        -d ./bin http://localhost:8080/WebserviceContainerManagement/container.wsdl"/>
          </exec>
       </target>
    </project>
    
  3. Start Web Service WebserviceContainerManagement
    • Rightclick on server Tomcat v6.0 Server at localhost and select Add Remove to configure the webservice
    • Rightclick on server Tomcat v6.0 Server at localhost and select Start
  4. Run Ant to generate Java code for the elements and complex types defined in the wsdl file.
    • Rightclick on build.xml and select Ant Build from Run AS. The Ant log messages appear in a console window
    • Rightclick on project and select Refresh. The generated classes appear in the package view.
    • Make sure the src folder is contained in the build path (Otherwise rightclick on folder src and select Add to Build Path from Build Path)
    • Force Build on project (Select Clean from eclipse menue Project and select the project in wizard)
  5. Run Client Webservice.
    • Create Java class TestClientWebServiceContainerManagement.java
    • Rightclick on class and select Java Application from Run AS
    • The console view shows the INFO log-messages of the TestClientWebServiceContainerManagement class Sending container Request and Response is: true.

Author: Rainer Schuler

Date: 2011-02-11 Fr

HTML generated by org-mode 7.4 in emacs 22