Overblog Tous les blogs Top blogs Technologie & Science Tous les blogs Technologie & Science
Editer l'article Suivre ce blog Administration + Créer mon blog
MENU

WS client Eclipse + Tomcat

10 Mars 2013 Publié dans #tomcat, #webservice, #java

refer : http://www-inf.it-sudparis.eu/~nguyen_n/teaching_assistant/web_services/webservice_client_generation

WS Client deployment with Eclipse WTP

In this tutorial we will see how Eclipse generate the Client stub.

  1. We start with the HelloWorld service created in the previous lab.
  2. File → New → Dynamic Web Project. Name it as HelloWorldClient.
  3. Click on the HelloWorldClient project, select File → New → Other → Web Service → Web Service Client.
  4. Click Next.
  5. Browse to the WS_HelloWorld → WebContent → wsdl → HelloWorld.wsdl file.
  6. Click OK. Then Next → Finish.
  7. Inside the HelloWorldClient → Java Resource → src → tps.ws.deployment package, create a new Class named TestClient and select the option public static void main.
  8. Copy and paste the following code:
    package tps.ws.deployment;

    import java.rmi.RemoteException;

    public class TestClient {

    /**
    * @param args
    * @throws RemoteException
    */
    public static void main(String[] args) throws RemoteException {
    // TODO Auto-generated method stub
    HelloWorldProxy hwp = new HelloWorldProxy();
    System.out.print(hwp.sayHello("ABC"));
    }
    }
  9. Right click on the TestClient class, select Run As → Java Application, if you get “Hello ABC” in the console, you are successful.
Publicité
Partager cet article
Repost0
Pour être informé des derniers articles, inscrivez vous :
Commenter cet article