1 package dynamicproxy; 2 3 import java.net.URL ; 4 import javax.xml.rpc.Service ; 5 import javax.xml.rpc.JAXRPCException ; 6 import javax.xml.namespace.QName ; 7 import javax.xml.rpc.ServiceFactory ; 8 import dynamicproxy.HelloSEI; 9 10 public class HelloDProxyClient { 11 12 15 public static void main(String [] args) { 16 try { 17 18 String UrlString = args[0] + "?WSDL"; 19 String nameSpaceUri = "urn:Hello/wsdl"; 20 String serviceName = "Hello"; 21 String portName = "HelloSEIPort"; 22 23 System.out.println("UrlString = " + UrlString); 24 URL helloWsdlUrl = new URL (UrlString); 25 26 ServiceFactory serviceFactory = 27 ServiceFactory.newInstance(); 28 29 Service helloService = 30 serviceFactory.createService(helloWsdlUrl, 31 new QName (nameSpaceUri, serviceName)); 32 33 dynamicproxy.HelloSEI myProxy = 34 (dynamicproxy.HelloSEI) 35 helloService.getPort( 36 new QName (nameSpaceUri, portName), 37 dynamicproxy.HelloSEI.class); 38 39 System.out.println(myProxy.sayHello("Buzz")); 40 41 } catch (Exception ex) { 42 ex.printStackTrace(); 43 } 44 } 45 46 } 47 | Popular Tags |