In this blog post I am going to talk about how to generate
the web service client out of WSDL.
Copy the WSDL to your workspace. (See how to generate the WSDL)
Right click WSDL file -> Web Services -> Generate
Client
Configure the server and web service runtime
Choose the output package and click Finish
Now
the web service proxy and other java files required for consuming the web
service would be created in the package given
Now let’s write a java web service client
HelloWorldClient.Java
package com.sri.client;
import
java.rmi.RemoteException;
import
com.sri.ws.HelloWorldImpl;
import
com.sri.ws.HelloWorldImplProxy;
public class HelloWorldClient {
public static void main(String args[]){
try {
HelloWorldImplProxy
proxy = new
HelloWorldImplProxy();
HelloWorldImpl
hello = proxy.getHelloWorldImpl();
System.out.println(hello.sayHello("Smith"));
}
catch (RemoteException e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment