01: package dynamicproxy;
02:
03: import java.net.URL;
04: import javax.xml.rpc.Service;
05: import javax.xml.rpc.JAXRPCException;
06: import javax.xml.namespace.QName;
07: import javax.xml.rpc.ServiceFactory;
08: import dynamicproxy.HelloSEI;
09:
10: public class HelloDProxyClient {
11:
12: /**
13: * @param args the command line arguments
14: */
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 = ServiceFactory
27: .newInstance();
28:
29: Service helloService = serviceFactory.createService(
30: helloWsdlUrl, new QName(nameSpaceUri, serviceName));
31:
32: dynamicproxy.HelloSEI myProxy = (dynamicproxy.HelloSEI) helloService
33: .getPort(new QName(nameSpaceUri, portName),
34: dynamicproxy.HelloSEI.class);
35:
36: System.out.println(myProxy.sayHello("Buzz"));
37:
38: } catch (Exception ex) {
39: ex.printStackTrace();
40: }
41: }
42:
43: }
|