试了好多次,都是这样。当使用Spring配置来发布两个或以上的类作为WebService的时候,只有配置文件里面的第一个可以被成功发布,以后的都会出错。

    配置文件如下:

xml 代码
  1. <jaxws:endpoint id="SampleService"     
  2.     implementor="fred.web.webservice.implementation.SampleServiceImpl" address="/SampleService">     
  3.     <jaxws:serviceFactory>     
  4.         <ref bean="jaxWsServiceFactoryBean"/>     
  5.     jaxws:serviceFactory>     
  6. jaxws:endpoint>     
  7.        
  8. <jaxws:endpoint id="ServiceForNetGeo"     
  9.     implementor="fred.web.webservice.implementation.ServiceForNetGeoImpl" address="/ServiceForNetGeo">     
  10.     <jaxws:serviceFactory>     
  11.         <ref bean="jaxWsServiceFactoryBean"/>     
  12.     jaxws:serviceFactory>     
  13. jaxws:endpoint>    

        比如,一个的wsdl路径为http://localhost/CxfSservice/ws/SampleService?wsdl, 一个的wsdl路径为http://localhost/CxfService/ws/ServiceForNetGeo?wsdl。那么,浏览器中打开第一个的地址的时候,可以发现生成的wsdl是正确的。但是当打开第二个地址的时候,会发现生成的wsdl和第一个地址的是一样的。

        查找了CXF提供的示例,都是只发布一个类的,没有发现有同时发布两个类的例子。或者这是CXF的bug?

评论
Frederick 2007-10-18
谢谢Jnn同学的指点。我做过测试以后,确实如此。
jnn 2007-10-15
你需要为不同的endpoint设置不同的ServiceFactory,具体的原因在CXF的mail list中有讨论

You can't reuse the service factory for two jaxws endpoints.
When the service factory create the endpoint, it will not create a new service model if the service factory's model is already there.
You need create a new service factory for endpoint to use.
发表评论

提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则

您还没有登录,请登录后发表评论

Frederick
搜索本博客
最近加入圈子
存档
最新评论