WS client Eclipse + Tomcat
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.
- We start with the HelloWorld service created in the previous lab.
- File → New → Dynamic Web Project. Name it as HelloWorldClient.
- Click on the HelloWorldClient project, select File → New → Other → Web Service → Web Service Client.
- Click Next.
- Browse to the WS_HelloWorld → WebContent → wsdl → HelloWorld.wsdl file.
- Click OK. Then Next → Finish.
- Inside the HelloWorldClient → Java Resource → src → tps.ws.deployment package, create a new Class named TestClient and select the option public static void main.
- 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"));
}
} - 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
Pour être informé des derniers articles, inscrivez vous :
Commenter cet article