我使用wsimport生成Web服务客户端。如此
wsimport -extension -keep -p [package] [wsdl file]
在java项目中使用它很有效。
但是我想在Grails项目中调用它。 所以我把wsimport生成的这些类放到了src / java文件夹中。 我在Grails项目的“控制器”中调用它,例如
*Holder<String> result = new Holder<String>()
Holder<String> description = new Holder<String>()
RCCWebServiceClientHandler.createSubscription(591, "1234", "1234324543", "453452345", "", 0, "78",4, "", "", result, description)
println(result.value)
println(description.value)*
发生异常
2015-03-19 17:44:13,162 [http-bio-8080-exec-1] ERROR errors.GrailsExceptionResolver - WebServiceException occurred when processing request: [GET] /GrailsExample/webservice/index
Method __execute is exposed as WebMethod, but there is no corresponding wsdl operation with name __execute in the wsdl:portType{http://syniverse.com}soap. Stacktrace follows:
Message: Method __execute is exposed as WebMethod, but there is no corresponding wsdl operation with name __execute in the wsdl:portType{http://syniverse.com}soap
Line | Method
->> 341 | freeze in com.sun.xml.internal.ws.model.JavaMethodImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 94 | freeze in com.sun.xml.internal.ws.model.AbstractSEIModelImpl
| 240 | buildRuntimeModel . . in com.sun.xml.internal.ws.model.RuntimeModeler
| 672 | createSEIPortInfo in com.sun.xml.internal.ws.client.WSServiceDelegate
| 660 | addSEI . . . . . . . . in ''
| 329 | getPort in ''
| 312 | getPort . . . . . . . in ''
| 294 | getPort in ''
| 119 | getPort . . . . . . . in javax.xml.ws.Service
| 72 | getSoapServiceImplPort in com.syniverse.sponsordata.ws.client.Soap_Service
| 38 | createSubscription . . in com.syniverse.sponsordata.ws.client.handler.RCCWebServiceClientHandler
| 16 | ws in com.syniverse.sponsordata.GroovyTest
| 15 | index . . . . . . . . in grailsexample.WebserviceController
| 198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter . . . . . . . in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
我不知道哪个方法调用__execute方法。为什么它使用java调用很好,但它在Grails Project中失败了?
更新
请参阅https://stackoverflow.com/questions/27317033/spring-wsdl-no-corresponding-wsdl-operation-with-name以了解这是关于Spring的类加载器问题。
添加后我使用了GGTS IDE
Dependency:
compile ":ws-client:1.0"
到BuildConfig.groovy
有效。但我仍然不确切地知道原因。
答案 0 :(得分:2)
我最近遇到了这个问题。
使用Grails 2.3.9,如果将此依赖项置于酸性BuildConfig.groovy中,问题似乎就会得到解决:
runtime "com.sun.xml.ws:jaxws-rt:2.1.7"
默认情况下,Grails环境有一个较旧的JAX-WS运行时,因此需要引入更新的。
另外,请参阅Alex Xu-s链接(在评论中)。