【技术贴】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" ...
随机推荐
- 【转载】Spark SQL 1.3.0 DataFrame介绍、使用
http://www.aboutyun.com/forum.php?mod=viewthread&tid=12358&page=1 1.DataFrame是什么?2.如何创建DataF ...
- Unity3d-UI插件EZGUI官方视频教程
Showcase Teaser (D/L) – Showcases some of the things that can be accomplished using EZ GUI.#1 – Butt ...
- Agile.Net 组件式开发平台 - 平台系统介绍
平台介绍 Agile.Net 组件式开发平台是一款针对企业级产品的开发框架,平台架构基于SOA服务体系,多层组件式架构打造.平台提供企业应用开发所需的诸如ORM.IOC.WCF.EBS.SOA等分布式 ...
- jquery 解析xml字符串
// 函数功能:把xml字符串转换成对象 function convertXmlStringToObj(xmlString) { var xmlObj = new Object; var xmlDoc ...
- sql server日期时间转字符串(转)
一.sql server日期时间函数Sql Server中的日期与时间函数 1. 当前系统日期.时间 select getdate() 2. dateadd 在向指定日期加上一段时间的基 ...
- java SimpleDateFormat非线程安全测试
public class MyThread extends Thread { private SimpleDateFormat sdf; private String dateString; publ ...
- Polyline转Polygon
IGeometry geo = feature.ShapeCopy; IGeometryCollection pPolyline = geo as IGeometryCollection; ISegm ...
- checkbox批量选中,获取选中的项的值
<!doctype html><html lang="en"> <head> <meta charset="UTF-8&quo ...
- WinForms 实现气泡提示窗口
[实例说明] 气泡提示因为他的美观又好被大多数用户所接收,用户所喜爱的就是程序员要实现的. 本实例实现了任务栏气泡提示,运行本实例,效果图如下所示: 单击提示.气泡提示就会显示,单击“关闭”气泡又会消 ...
- android.intent.action.MAIN 与 android.intent.category.LAUNCHER 的验证理解
第一种情况:有MAIN,无LAUNCHER,程序列表中无图标 原因:android.intent.category.LAUNCHER决定应用程序是否显示在程序列表里 第二种情况:无MAIN,有LAU ...