1新建web service project
2记得选择xfire
3导入xfire包
4在src目录下写文件
5修改servicexml对service进行注册
6代码如下
service.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
<name>sayHello</name>
<serviceClass>my_interface</serviceClass>
<implementationClass>
my_implementment
</implementationClass>
<style>wrapped</style>
<use>literal</use>
<scope>application</scope>
</service>
</beans>
my_interface
public interface my_interface {
public String sayHello(String name);
}
my_implementment
public class my_implementment implements my_interface{
public String sayHello(String name) {
// TODO Auto-generated method stub
return name+",hello";
}
}