01: package samples.jaxrpc.hello;
02:
03: import javax.xml.namespace.QName;
04: import javax.xml.rpc.Service;
05: import javax.xml.rpc.ServiceFactory;
06: import java.net.URL;
07:
08: public class HelloClient {
09: public static void main(String[] args) throws Exception {
10: String UrlString = "http://localhost:8080/axis/services/HelloPort?wsdl";
11: String nameSpaceUri = "http://hello.jaxrpc.samples/";
12: String serviceName = "HelloWorld";
13: String portName = "HelloPort";
14:
15: URL helloWsdlUrl = new URL(UrlString);
16: ServiceFactory serviceFactory = ServiceFactory.newInstance();
17: Service helloService = serviceFactory.createService(
18: helloWsdlUrl, new QName(nameSpaceUri, serviceName));
19:
20: java.util.List list = helloService.getHandlerRegistry()
21: .getHandlerChain(new QName(nameSpaceUri, portName));
22: list.add(new javax.xml.rpc.handler.HandlerInfo(
23: ClientHandler.class, null, null));
24:
25: Hello myProxy = (Hello) helloService.getPort(new QName(
26: nameSpaceUri, portName),
27: samples.jaxrpc.hello.Hello.class);
28:
29: System.out.println(myProxy.sayHello("Buzz"));
30: }
31: }
|