webservice -XFire 服务器端环境搭建
编程技术  /  houtizong 发布于 3年前   81
<?xml version="1.0" encoding="GB2312"> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>XFireServlet</servlet-name> <display-name>XFire Servlet</display-name> <servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>XFireServlet</servlet-name> <url-pattern>/servlet/XFireServlet/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>XFireServlet</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping> </web-app>
package com.eagle.bean;import java.io.Serializable;import java.util.Date;public class Person implements Serializable {private int id;private String name;private int age;private Date birthday;public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public Date getBirthday() {return birthday;}public void setBirthday(Date birthday) {this.birthday = birthday;}public String toString() {return "id:" + id + ", name:" + name + ", age:" + age + "birthday: "+ birthday;}}
package com.eagle.service;import java.util.Date;import java.util.List;import com.eagle.bean.Person;/** * TODO web服务接口 date:Jan 14, 2010 time:2:29:49 PM author:wxj * email:[email protected] */public interface PersonService {/** * 返回一个String类型 * * @param name * @return */public String sayHello(String name);/** * 返回一个int类型 * * @return */public int getAge();/** * 返回一个Date类型 * * @return */public Date getBirthday();/** * 返回一个自定义类型 * * @return */public Person getPerson();/** * 返回一个复杂类型 * * @return */public List<Person> getPersons();}
package com.eagle.service;import java.util.ArrayList;import java.util.Date;import java.util.List;import com.eagle.bean.Person;/** * TODO web服务接口实现类 date:Jan 14, 2010 time:2:29:49 PM author:wxj * email:[email protected] */public class PersonServiceImpl implements PersonService {public int getAge() {return (int) (Math.random() * 100);}public Date getBirthday() {return new Date();}public Person getPerson() {Person person = new Person();person.setId(1);person.setAge(60);person.setName("china");person.setBirthday(new Date());return person;}public List<Person> getPersons() {List<Person> persons = new ArrayList<Person>();Person person1 = new Person();person1.setId(1);person1.setAge(60);person1.setName("ls");person1.setBirthday(new Date());persons.add(person1);Person person2 = new Person();person2.setId(2);person2.setAge(50);person2.setName("bj");person2.setBirthday(new Date());persons.add(person2);Person person3 = new Person();person3.setId(3);person3.setAge(56);person3.setName("ww");person3.setBirthday(new Date());persons.add(person3);return persons;}public String sayHello(String name) {return "hello," + name + ",welcome to xfire";}}
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://xfire.codehaus.org/config/1.0"> <service> <name>Person</name> <serviceClass>test.services.IPerson</serviceClass> <implementationClass> test.services.PersonImpl </implementationClass> </service></beans>
请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!
技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成
网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];
文章归档
文章标签
友情链接