今天做了一个CXF的入门例子,有关代码如下:
接口类:
@WebService
public interface OrderProdess {
String order(String name);
}
接口实现类:
@WebService(endpointInterface = "service01.OrderProdess", serviceName = "orderService")
public class OrderProdessImpl implements OrderProdess {
@Override
public String order(String name) {
String orderStr = "excute order," + name;
return orderStr;
}
}
接着是服务端代码:
public class ServerClient {
public static void main(String[] args) throws InterruptedException {
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceClass(OrderProdessImpl.class);
factory.setAddress("http://localhost:8080/cxfDemo02/orderService");
Server server = factory.create();
server.start();
System.out.println("server start...");
Thread.sleep(60*1000);
System.out.println("server destory...");
//server.destroy();
server.stop();
}
}
执行服务端代码,没报什么错误,可是在浏览器中通过“http://localhost:8080/cxfDemo02/orderService?wsdl”,可访问不到,请各位大神指点一下!
CXF WebService部署实战
136

被折叠的 条评论
为什么被折叠?



