KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > samples > jaxrpc > hello > HelloClient


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