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://service.webservice.com/")
public class Server1Impl implements Server1 { public String getInfo(String name, int age) {
return name.concat(",Hello Word! ! " + name + " age: " + age);
} public static void main2(String[] args) {
Server1Impl serverImpl = new Server1Impl();
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceClass(Server1.class); factory.setAddress("http://localhost:1111/server1");
factory.setServiceBean(serverImpl);
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getInInterceptors().add(new LoggingOutInterceptor()); factory.create(); } }

以下摘自:http://www.cnblogs.com/yshyee/p/3633537.html

信息: Created classes: com.test.server.HelloWorld, com.test.server.HelloWorldResponse, com.test.server.ObjectFactory
Exception in thread "main" org.apache.cxf.common.i18n.UncheckedException: No operation was found with the name {http://impl.server.test.com/}helloWorld.
   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:342)
   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:336)
   at com.test.client.HelloWorl.main(HelloWorl.java:20)
Java Result: 1

解决方法:对服务端的接口实现类中的@WebService添加targetNamespace,其值为接口包名的倒置,

例如我的IHelloWorld接口所在的包为com.test.server,此时对应的targeNamespace的值为http://server.test.com/

例如:

@WebService(
endpointInterface = "com.test.server.IHelloWorld",
serviceName="helloWorld",
targetNamespace="http://server.test.com/")
public class HelloWorldImp implements IHelloWorld { public String helloWorld(String name) {
return name+" Hello,World!"; }
    

【技术贴】webservice cxf2 客户端动态调用报错No operation was found with the name的更多相关文章

  1. dubbo 使用zookeeper 出现 Dubbo客户端调用报错NullPointerException

    现在将网上的方法总结一下 方法一:.https://blog.csdn.net/u011294519/article/details/81810631 dubbo-provider.xml:提供者先扫 ...

  2. Struts2.3动态调用报 No result defined for action 错误

    struts 2.3.16  採用动态调用发现不工作报404 not found,网上查找原因: 1.由于:struts2中默认不同意使用DMI 所以:须要在配置文件里打开: <constant ...

  3. CFX客户端调用报错

    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: unex ...

  4. Windows平台下使用CodeBlocks+GCC编译器生成动态dll,C#调用报错

    报无法加载dll错误,解决方法: 1) 编译选择设置成x86,即-m322) 必须在c#程序目录下加上libgcc_s_dw2-1.dll

  5. Weblogic10.3.6部署解决CXF webService 调用报错: “Cannot create a secure XMLInputFactory”

    一,解决步骤 1.添加jar包 stax2-api-3.1.4.jar woodstox-core-asl-4.4.1.jar 2.编写监听器 package com.neusoft.cxf.list ...

  6. springboot多模块项目下,子模块调用报错:程序包xxxxx不存在

    今天在用springboot搭建多模块项目,结构中有一个父工程Parent  一个通用核心工程core 以及一个项目工程A 当我在工程A中引入core时,没有问题,maven install正常 当我 ...

  7. jmeter 启动jmeter-server.bat远程调用报错: java.io.FileNotFoundException: rmi_keystore.jks (系统找不到指定的文件。)

    1.找到apache-jmeter-5.0\bin\jmeter.properties 2.修改server.rmi.ssl.disable=true (记得去除server.rmi.ssl.disa ...

  8. bug:进程可调用函数而子线程调用报错

    在调试摄像头时遇到问题:在主进程里调用下述函数能够成功,但在子线程里创建时总是失败,错误打印为 sched: RT throttling activated. UniqueObj<OutputS ...

  9. artTemplate--使用artTemplate时,由于json对象属性有特殊格式 导致调用报错artTemplate,syntax error,Template Error

    我们首先看下面的代码 data = { "siteName" : "西部云谷二期17", "PM10" : "10017" ...

随机推荐

  1. 软谋在线教育诚招php,java,.net,设计师讲师(可兼职)

    软谋教育专注软件在线教育,依托腾讯课堂.yy课堂授课,在线教授计算机知识,现因业务发展,招聘php,java,.net,设计师讲师各两名,如果您满足以下条件,即可联系我们应聘: 1.相关专业工作经验3 ...

  2. .net 获取网站根目录总结

    一.获取网站根目录的方法有几种如: Server.MapPath(Request.ServerVariables["PATH_INFO"]) //页面详细路 Server.MapP ...

  3. 第三十九篇、NavBar动态隐藏、设置透明、毛玻璃效果

    1.动态隐藏 - (void)viewDidLoad { [super viewDidLoad]; if ([self respondsToSelector:@selector(automatical ...

  4. css笔记——杂记

    ####文本框内阴影#### input[type=text], textarea, input[type=email], input[type=url]{ box-shadow: inset 2px ...

  5. 关于IE8以上 不引人css 症状

    不知道各位有没有体验过 这样的状况  在同一个文件夹中 <!DOCTYPE html> <html> <head> <meta charset="u ...

  6. OpenCV3添加滑动条和鼠标事件到图形界面

    鼠标事件和滑动条控制在计算机视觉和OpenCV中非常有用,使用这些控件,用户可以直接与图形界面交互,改变输入图像或者变量的属性值. /* In this section, we are going t ...

  7. Spring多数据源的动态切换

    Spring多数据源的动态切换 目前很多项目中只能配置单个数据源,那么如果有多个数据源肿么办?Spring提供了一个抽象类AbstractRoutingDataSource,为我们很方便的解决了这个问 ...

  8. KnockoutJS(4)-控制文本和外观绑定

    控制文本和外观绑定 依赖关系:除了Knockout核心库之外,无依赖关系. 类别 目的 Visible绑定 Visible绑定通过绑定一个值来确定DOM元素显示或隐藏 Text绑定 Text绑定主要是 ...

  9. php学习日志(2)-php变量

    变量是用于存储数据的容器,与代数相似,可以给变量赋予某个确定的值(例如:$x=3)或者是赋予其它的变量(例如:$x=$y+$z).变量的定义主要有以下规则: 变量以$开始,后面跟着变量的名称: 变量名 ...

  10. 【生活】已经从官网购买iPad,单独购买AppleCare+服务

    1 什么是AppleCare+服务 从苹果官网购买的硬件产品如ipad.iphone和MacBook等,官网承诺的保修期限是一年.AppleCare+是水果公司推出的一种保修服务,最大的特点就是将保修 ...