【web.xml】
[html] view plaincopy
< xml version="1.0" encoding="UTF-8" >
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
org.codehaus.xfire.transport.http.XFireConfigurableServlet
【客户端项目文件】
y
package com.feihuale.xfire.test;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import com.feihuale.xfire.demo.ITestService;
public class MyClient {
/**
* @param args
*/
public static void main(String[] args) {
try {
Service serviceModel = new ObjectServiceFactory().create(
ITestService.class, "TestService",
"http://com/feihuale/xfire/demo/ITestService", null);
ITestService service = (ITestService) new XFireProxyFactory()
.create(serviceModel,
"http://localhost:8080/TestXFire/services/TestService");
System.out.println("返回值是:" + service.add(5, 8));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}
摘自 feihuale的专栏