1. 环境准备
下载axis2-eclipse-codegen-wizard.zip、axis2-eclipse-service-archiver-wizard.zip,这两个是eclipse的开发axis2的插件。
将以上两个插件解压放到eclipse\plugins目录下。
打开eclipse>>File>>new>>other下是否有Axis2 Wizards。
2. axis2插件开发webservice客户端:
http://www.blogjava.net/parable-myth/archive/2010/08/03/327802.html (需要启动服务器)
创建axis2出现java.lang.reflect.invocationtargetexception异常解决:
http://hefeidaxia.iteye.com/blog/501098
3. 生成客户端代码
创建项目,命名为DynamicAxisClient。
右击DynamicAxisClient>>new>>other>>Web Services>>Web service Client>>next>>选择服务器中的wsdl文件>>OK。
src目录下会自动生成com\dynamic\axis\server包,包中包含5个java文件.
4. 编写AxisDynamicClient.java文件调用web service服务.
package com.dynamic.axis.test;
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import org.apache.axis.AxisFault;
import com.dynamic.axis.server.HelloWorldService;
import com.dynamic.axis.server.HelloWorldServiceLocator;
import com.dynamic.axis.server.HelloWorldSoapBindingStub;
public class AxisDynamicClient {
public static void main(String[] args) {
HelloWorldService service = new HelloWorldServiceLocator();
String url = service.getHelloWorldAddress();
try {
java.net.URL endpointURL = new java.net.URL(url);
HelloWorldSoapBindingStub stub = new HelloWorldSoapBindingStub(endpointURL,null);
String str = stub.sayHello("");
System.out.println(str);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (AxisFault e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
分享到:
相关推荐
MyEclipse下开发Web Service(Axis)
web service 使用 axis2 框架使用的插件 必不可少的
MyEclipse下开发Web Service(Axis2)
Axis开发Web Service实例,介绍AXIS的三种方法
web service Axis2相关jar 里面包含了Axis2 java调用.net接口所需jar包
Web Service WebService Axis一个完整的客户端代码
用axis2开发web service,过程比用axis1开发web service简单
Web Service Axis2-1.6.2框架使用 压缩包里有:文档说明,axis2-1.6.2-bin.zip、axis2-1.6.2-war.zip、axis2-eclipse-codegen-plugin-1.6.2.zip、axis2-eclipse-service-plugin-1.6.2.zip。文档里用的所有jar压缩包...
web service axis 1.6。配置说明,客户端,服务端代码
基于AXIS2实现Web Service开发
WebService大讲堂之Axis2,Axis2教程,axis2教程例子,Web_Service实例应用
MyEclipse下开发Web Service(Axis)2,步骤简单清晰。
.Web Service简介 .如何开发一个Web Service .Axis2简介 .Axis2安装与部署 .Web Service开发步骤
Chapter 1, Apache Web Services and Axis2 - Gives you an introduction to web services and the web service stack at Apache. Chapter 2, Looking inside Axis2 - Learn about Axis2 architecture and the ...
Web Service (Axis 1.1) step by step.ppt 用AXIS开发webservice一步
Axis2创建web service快速入门
MyEclipse下开发Web_Service(Axis2),全部免费下载了,全部免费了,非常的好用
在eclipse中用axis2开发Web Service,加快开发速度