HelloClient.java

 


 /*
  *
  * 
  */
 
 
 package proxy;
 
 import java.net.URL;
 import javax.xml.rpc.Service;
 import javax.xml.rpc.JAXRPCException;
 import javax.xml.namespace.QName;
 import javax.xml.rpc.ServiceFactory;
 
 public class HelloClient {
 
     public static void main(String[] args) {
         try {
 
             String UrlString = "http://localhost:8080/proxy-jaxrpc/proxy?WSDL";
             String nameSpaceUri = "http://com.test/wsdl/MyHello";
             String serviceName = "MyHello";
             String portName = "HelloIFPort";
 
             URL helloWsdlUrl = new URL(UrlString);
             
             ServiceFactory serviceFactory = ServiceFactory.newInstance();
             
             Service helloService = serviceFactory.createService(helloWsdlUrl, 
                 new QName(nameSpaceUri, serviceName));
             
             HelloIF myProxy = (HelloIF) helloService.getPort(
                 new QName(nameSpaceUri, portName), 
                 proxy.HelloIF.class); 
 
             System.out.println(myProxy.sayHello("Buzz"));
 
         } catch  Exception(ex) {
             ex.printStackTrace();
         } 
     } 
 }