论坛首页 Java企业应用论坛

CXF WebService视频教程,自己录的(更新第7集 异步调用 2009.1.15)。

浏览 107982 次
该帖已经被评为精华帖
作者 正文
   发表时间:2009-05-21  
楼主辛苦了,分享精神值得学习,只有技术推广开来,才更有前景
0 请登录后投票
   发表时间:2009-05-25  
非常感谢....
0 请登录后投票
   发表时间:2009-05-29  
费了我好大的劲才可以回复帖子呀,真的是想感谢楼主的奉献精神,等我以后学到好的知识了,我也共享出来。
0 请登录后投票
   发表时间:2009-05-29  
我的MainServer 怎么起不起来,帮我看看。。

package test;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
public class MainServer {
public static void main(String[] args) {

JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceClass(HelloWorldImpl.class);
factory.setAddress("http://localhost:8080/HelloWorld");
Server server = factory.create();
server.start();
}
}

2009-5-29 22:08:38 org.apache.cxf.bus.spring.BusApplicationContext getConfigResources
信息: No cxf.xml configuration file detected, relying on defaults.
2009-5-29 22:08:40 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://test/}HelloWorldImplService from class test.HelloWorld
Exception in thread "main" org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:137)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:168)
at test.MainServer.main(MainServer.java:17)
Caused by: org.apache.cxf.BusException: No DestinationFactory was found for the namespace http://schemas.xmlsoap.org/soap/http.
at org.apache.cxf.transport.DestinationFactoryManagerImpl.getDestinationFactory(DestinationFactoryManagerImpl.java:115)
at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:85)
at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:118)
0 请登录后投票
   发表时间:2009-05-29  
我在web系统里部署了webservice,用http://localhost:8080/ws/services/能察看到我部署的服务,但运行HelloWorldClient,在Creating Service {http://test/}HelloWorldService from class test.HelloWorld时死了,
请帮忙看看怎么回事?错误信息如下:

2009-5-29 22:15:58 org.apache.cxf.bus.spring.BusApplicationContext getConfigResources
信息: No cxf.xml configuration file detected, relying on defaults.
2009-5-29 22:16:00 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://test/}HelloWorldService from class test.HelloWorld


代码:
package test;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
@WebService
public interface HelloWorld {
@WebResult(name = "sayHelloResult")
String sayHello(@WebParam(name = "name")
String name);
}


package test;
import javax.jws.WebService;
@WebService
public class HelloWorldImpl implements HelloWorld {
public String sayHello(String name) {
System.out.println("sayHello is called!");
return "Server response:" + name;
}
}


package test;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
public class HelloWorldClient {
public static void main(String[] args) {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress("http://localhost:8080/ws/services/HelloWorld");
factory.setServiceClass(HelloWorld.class);
HelloWorld helloWorld = (HelloWorld) factory.create();
System.out.println(helloWorld.sayHello("Wubiao"));
}
}

applicationContext-cxf.xml:
    <jaxws:endpoint id="helloWorld"         implementor="test.HelloWorldImpl" address="/HelloWorld" />

我用的cxf2.2版


http://localhost:8080/ws/services/------〉
Available services:
HelloWorld
sayHello
Endpoint address: http://localhost:8080/ws/services/HelloWorld
Wsdl: {http://test/}HelloWorldImplService
Target namespace: http://test/

0 请登录后投票
   发表时间:2009-05-29  
我在web系统里部署了webservice,用http://localhost:8080/ws/services/能察看到我部署的服务,但运行HelloWorldClient,在Creating Service {http://test/}HelloWorldService from class test.HelloWorld时死了

------------------〉
已解决。
原因:
我再同一个myeclipse里调试代码,
在HelloWorldImpl里设了断点,
但是当程序执行到断点处时,
myeclipse试图并没切换过去,
我误以为程序死了。。。。
0 请登录后投票
   发表时间:2009-05-31  
关注,感谢楼主
0 请登录后投票
   发表时间:2009-06-01  
太伟大的人了!
0 请登录后投票
   发表时间:2009-06-07  
不错要是有xfire就好公司用的就是xfire
0 请登录后投票
   发表时间:2009-06-17  
都看了,辛苦楼主,比我自己看书快多了,也简单明了,qqq
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics