| 1 |
package samples.jaxrpc.hello; |
| 2 |
|
| 3 |
import javax.xml.namespace.QName; |
| 4 |
import javax.xml.rpc.Service; |
| 5 |
import javax.xml.rpc.ServiceFactory; |
| 6 |
import java.net.URL; |
| 7 |
|
| 8 |
public class HelloClient { |
| 9 |
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(helloWsdlUrl, |
| 18 |
new QName(nameSpaceUri, serviceName)); |
| 19 |
|
| 20 |
java.util.List list = helloService.getHandlerRegistry().getHandlerChain(new QName(nameSpaceUri, portName)); |
| 21 |
list.add(new javax.xml.rpc.handler.HandlerInfo(ClientHandler.class,null,null)); |
| 22 |
|
| 23 |
Hello myProxy = (Hello) helloService.getPort( |
| 24 |
new QName(nameSpaceUri, portName), |
| 25 |
samples.jaxrpc.hello.Hello.class); |
| 26 |
|
| 27 |
System.out.println(myProxy.sayHello("Buzz")); |
| 28 |
} |
| 29 |
} |