package test;
import java.util.ArrayList;
import java.util.List;
public class HelloServiceImpl implements IHelloService
{
public String sayHello(String message)
{
return "Hello, " + message;
}
public Course choose(User user)
{
System.out.println("在服务器," + user.getName());
Course c = new Course();
c.setName("Huyvanpull");
return c;
}
public List<Course> test(List<String> lst)
{
for (int i = 0; i < lst.size(); i++)
{
System.out.println("在服务器," + lst.get(i));
}
List<Course> list = new ArrayList<Course>();
Course c = new Course();
c.setName("hvyvanpull_list");
list.add(c);
return list;
}
}
services.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
<name>HelloService</name>
<namespace>http://test/HelloService</namespace>
<serviceClass>test.IHelloService</serviceClass>
<implementationClass>test.HelloServiceImpl</implementationClass>
</service>
</beans>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>
org.codehaus.xfire.transport.http.XFireConfigurableServlet
</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>