No operation was found with the name xxx
出错原因是因为发布服务的接口所在包路径和此接口实现类包路径不一致,比如你的服务接口可能放在了包com.x.interFace下,但是你的实现类却在com.x.interFace.impl包下,此时,发布的服务被客户端动态调用(JaxWsDynamicClientFactory)的时候,就会报错:
org.apache.cxf.common.i18n.UncheckedException: No operation was found with the name {http://impl.server.test.com/}xxxx.
就是说找不到某个方法
解决办法也很简单:直接在你的实现类上,加上注解:targetNamespace = "http://service.webservice.com/",这个包名(服务接口所在的包名)反写
如下:
我的实现类包名是com.webservice.service.impl
我的服务接口包名:com.webservice.service
所以 targetNamespace要写成我的服务接口所在包名的反写
@WebService(endpointInterface = "com.webservice.service.Server1", serviceName = "server1", targetNamespace = "http