基于Axis1.4的webservice接口开发(接口调用)
2021-07-03 03:04
标签:需要 ring void lock target services operation hello blog 基于Axis1.4的webservice接口开发(接口调用) 一、webservice接口代码参考上一篇博客: http://www.cnblogs.com/zhukunqiang/p/7125668.html 二、代码部分 1、新建Web Project工程,取名为axiswebserviceClint,并导入Axis1.4所需jar包(将jar包粘贴到lib目录)。 2、新建webservice接口调用类: 3、点击运行java类(直接运行java文件,不需要将web工程部署到Tomcat中就可直接运行):
调用成功! 基于Axis1.4的webservice接口开发(接口调用) 标签:需要 ring void lock target services operation hello blog 原文地址:http://www.cnblogs.com/zhukunqiang/p/7125691.htmlpackage com.no8.clint;
import java.net.URL;
import javax.xml.rpc.ServiceException;
import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class WebClient {
public static void main(String[] args) throws Exception {
String endpoint = "http://localhost:8080/axiswebservice/services/HelloWorld?wsdl";
//创建一个服务(service)调用(call)
Service service = new Service();
Call call = (Call) service.createCall();
//设置service所在的url
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperation("sayHello");
String ret = (String)call.invoke(new Object[]{"张三"});
System.out.println(ret);
}
}
文章标题:基于Axis1.4的webservice接口开发(接口调用)
文章链接:http://soscw.com/index.php/essay/101070.html