【技术贴】webservice cxf2 客户端动态调用报错No operation was found with the name
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的更多相关文章
- dubbo 使用zookeeper 出现 Dubbo客户端调用报错NullPointerException
现在将网上的方法总结一下 方法一:.https://blog.csdn.net/u011294519/article/details/81810631 dubbo-provider.xml:提供者先扫 ...
- Struts2.3动态调用报 No result defined for action 错误
struts 2.3.16 採用动态调用发现不工作报404 not found,网上查找原因: 1.由于:struts2中默认不同意使用DMI 所以:须要在配置文件里打开: <constant ...
- CFX客户端调用报错
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: unex ...
- Windows平台下使用CodeBlocks+GCC编译器生成动态dll,C#调用报错
报无法加载dll错误,解决方法: 1) 编译选择设置成x86,即-m322) 必须在c#程序目录下加上libgcc_s_dw2-1.dll
- 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 ...
- springboot多模块项目下,子模块调用报错:程序包xxxxx不存在
今天在用springboot搭建多模块项目,结构中有一个父工程Parent 一个通用核心工程core 以及一个项目工程A 当我在工程A中引入core时,没有问题,maven install正常 当我 ...
- 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 ...
- bug:进程可调用函数而子线程调用报错
在调试摄像头时遇到问题:在主进程里调用下述函数能够成功,但在子线程里创建时总是失败,错误打印为 sched: RT throttling activated. UniqueObj<OutputS ...
- artTemplate--使用artTemplate时,由于json对象属性有特殊格式 导致调用报错artTemplate,syntax error,Template Error
我们首先看下面的代码 data = { "siteName" : "西部云谷二期17", "PM10" : "10017" ...
随机推荐
- 使用spring+mybatis+atomikos+tomcat构建分布式事务
本文通过一个demo,介绍如何使用spring+mybatis+atomikos+tomcat构建在一个事务中涉及两个数据源的web应用. demo功能:实现一个能成功提交和回滚的涉及两个数据库数据源 ...
- ORACLE字符串分组聚合函数(字符串连接聚合函数)
ORACLE字符串连接分组串聚函数 wmsys.wm_concat SQL代码: select grp, wmsys.wm_concat(str) grp, 'a1' str from dual un ...
- win10下怎么在桌面创建IIS快捷方式
在电脑上打开C:\Windows\System32\inetsrv,在里面找到InetMgr.exe,如图 2 右击InetMgr.exe会发现没有发送到桌面的选项,所以我们选择创建快捷方式,如图 3 ...
- Java之趣味编程结婚问题
问题如下:判断结婚的组合对数数.定义: 好三位新郎为 A,B,C ;三位新娘为X,Y,Z 有人想要知道他们谁和谁结婚 ,于是问了其中的三位. 回答是这样的:A说他将和X结婚 :X说她的未婚夫是C ;C ...
- 第三十八篇、给UITabBar按钮的动画效果
在很多情况下,我们也时常有这样的需求,就是在UITabBar切换的时候,添加一些动画效果 1.在UITabBar触发点击方法的时候捕获当前点击的item 2.使用coreAnimation设置动画效果 ...
- [EAP]将hostapd作为radius服务器搭建EAP认证环境
文章主要由以下几部分组成: 0.概念理解: WPA/WPA2,EAP,IEEE, 802.11i, WiFi联盟, 802.1x 1.编译hostapd 2.配置hostapd的conf文件 3.外接 ...
- 关联 Android 源代码 到 Ecplise
1. 下载android 源码存于本地硬盘; 2. 打开Eclpise, 新建Android Project; 3. 在MainActivity文件中,按住Ctrl 点击Activity类 4. 弹出 ...
- thinkphp 前后版本ajaxReturn方法的分别
之前用的是thinkphp2的版本现在改到thinkphp3.2已上的版本,发现ajaxReturn这个方法返回的数据不一样了,现在做下记录 thinkphp2的ajaxReturn的实现原码 pro ...
- 深度优先算法DFS
英雄要从H点出发,去解救位于M点的美女. 迷宫的围墙用#表示,带*号的位置表示有杀手埋伏,这些点都是不能走的, 那么英雄要最少走多少步才能解救美女呢? package myalgorithm; imp ...
- 关于浏览器兼容处理—— 识别IE浏览器
var b_name = navigator.appName;var b_version = navigator.appVersion;var version = b_version.split(&q ...