helloclient.java
来自「简单的用axis实现的一个web服务」· Java 代码 · 共 35 行
JAVA
35 行
package samples.jaxrpc.hello;import javax.xml.namespace.QName;import javax.xml.rpc.Service;import javax.xml.rpc.ServiceFactory;import java.net.URL;import javax.naming.*;public class HelloClient { public static void main(String[] args) throws Exception {// String UrlString = "http://localhost:8080/axis/services/HelloPort?wsdl";// String nameSpaceUri = "http://hello.jaxrpc.samples/";// String serviceName = "HelloWorld";// String portName = "HelloPort";//// URL helloWsdlUrl = new URL(UrlString);// ServiceFactory serviceFactory = ServiceFactory.newInstance();// Service helloService = serviceFactory.createService(helloWsdlUrl,// new QName(nameSpaceUri, serviceName));//// java.util.List list = helloService.getHandlerRegistry().getHandlerChain(new QName(nameSpaceUri, portName));// list.add(new javax.xml.rpc.handler.HandlerInfo(ClientHandler.class,null,null));//// Hello myProxy = (Hello) helloService.getPort(// new QName(nameSpaceUri, portName),// samples.jaxrpc.hello.Hello.class);//// System.out.println(myProxy.sayHello("Buzz")); Context ctx=new InitialContext(); Hello hello=(Hello)ctx.lookup("java:comp/env/services/HelloPort"); hello.sayHello("a"); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?