NutzCN Logo
精华 nutz如何集成cxf
发布于 2953天前 作者 苍蓝猛兽 1903 次浏览 复制 上一个帖子 下一个帖子
标签:

在社区搜cxf后,出现的结果很少,也没有我想要的那样...

项目是要打成可运行jar包,都是在main函数中跑的.... 可有什么好的集成方案

11 回复

内嵌jetty?

@wendal 这是我在网上搜的简单的cxf的方案,没有集成nutz,大神帮忙看下
@WebService
public interface HelloWorld {
String sayHi(@WebParam(name="text")String text);
}

@WebService(endpointInterface = "com.nari.nwims.busdown.itsm.webservice.HelloWorld", serviceName = "HelloWorld")
public class HelloWorldImpl implements HelloWorld {

public String sayHi(String text) {
    return "Hello " + text;
}

}

public class Server {
public static void main(String[] args) {
System.out.println("web service start");
HelloWorldImpl implementor = new HelloWorldImpl();
String address = "http://localhost:8080/helloWorld";
Endpoint.publish(address, implementor);
System.out.println("web service started");
// 启动服务后,可以在浏览器中访问 http://localhost:8080/helloWorld?wsdl 查看是否显示
}
}

public class Client {
public static void main(String[] args) {
JaxWsProxyFactoryBean svr = new JaxWsProxyFactoryBean();
svr.setServiceClass(HelloWorld.class);
svr.setAddress("http://localhost:8080/helloWorld");
HelloWorld hw = (HelloWorld) svr.create();
System.out.println(hw.sayHi("11111"));
}
}

请问这种方式好吗? 并没有利用配置文件的方式,个人觉得比较简单方便,但又不懂其中的原理,还请大神指点

那直接用不就好了

@wendal 你的意思就是这种方式是可行的?????

@wendal 上面问题是jdk版本老的问题吗?虽然不是nutz的问题,但是请求大神帮助,好多天了都没有解决

擦,我不是说了是jdk版本老了吗

@wendal 我们项目要求jdk版本为1.6...请问有其他解决方式吗

不清楚,谷歌cxf和jdk6吧

添加回复
请先登陆
回到顶部