eclipse jee + axis2 + axis eclipse plugin 开发Web Service


1.下载 eclipse javaee 版本
2.下载 axis2-1.5.6 axis2-1.6.*和目前的插件不匹配
3.下载   axis2-eclipse-service-archiver-wizard-1.4.zip
        axis2-eclipse-codegen-wizard-1.4.zip 
        download site:http://archive.apache.org/dist/ws/axis2/tools/1_4/
4.安装插件:
  下载完2个压缩文件后,可以直接把解压后的文件拷贝到eclipse 的 plugins目录中
  backport-util-concurrent-3.1.jar 和 geronimo-stax-api_1.0_spec-1.0.1.jar
  复制到 eclipse\plugins\Axis2_Codegen_Wizard_1.3.0\lib 文件夹下。
  download site:http://www.findjar.com/jar/mule/dependencies/maven2/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar.html
5.修改eclipse\plugins\Axis2_Codegen_Wizard_1.3.0\plugin.xml 文件
  在 <runtime> 內加入下面的字串
    <library name="lib/geronimo-stax-api_1.0_spec-1.0.1.jar">
       <export name="*"/>
    </library>
    <library name="lib/backport-util-concurrent-3.1.jar">
        <export name="*"/>
    </library>
6.把Axis2_Codegen_wizard_1.3.0(eclipse/plugins/Axis2_Codegen_wizard_1.3.0)的名字改成Axis2_Codegen_wizard_1.4.0
  在plugin.xml中在<plugin>中 把Axis2_Codegen_wizard的version="1.3.0"改成version="1.4.0"
到plugin.xml文件中,保存后重新启动Eclipse即可。


Developing Web Services Using Apache Axis2 Eclipse Plugins
http://wso2.org/library/1719

package com.ws.service;

public class SayHello {

	public String sayHello(String name){
		return "Hello , " + name;
	}
}


package com.ws.client.test;

import java.rmi.RemoteException;

import org.apache.axis2.AxisFault;

import com.ws.service.client.MyServiceStub;
import com.ws.service.client.MyServiceStub.SayHello;

public class WStest {

	public static void main(String args[]){
		try {
			MyServiceStub stub = new MyServiceStub();
			SayHello sayhello = new SayHello();
			sayhello.setName("xiewenbo");
			String response = stub.sayHello(sayhello).get_return();
			System.out.println(response);
		} catch (AxisFault e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

猜你喜欢

转载自xiewenbo.iteye.com/blog/1299820