问题描述
我使用wsimport来生成一个Web服务客户端。例如
wsimport -extension -keep -p [软件包] [wsdl文件]
但我想在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,,描述)
println(result.value)
println(description.value)*
2015-03-19 17:44:13,162 [http-bio-8080-exec-1] ERROR errors.GrailsExceptionResolver - 处理请求时发生WebServiceException:[GET] / GrailsExample / webservice / index
方法__execute作为WebMethod公开,但在wsdl:portType中没有对应的名为__execute的wsdl操作{http: /syniverse.com}soap。 Stacktrace如下:
消息:方法__execute作为WebMethod公开,但在wsdl:portType {http://syniverse.com} soap
中没有使用名称__execute的相应wsdl操作。方法
- >> 341 |冻结在com.sun.xml.internal.ws.model.JavaMethodImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 94 |冻结在com.sun.xml.internal.ws.model.AbstractSEIModelImpl
| 240 | buildRuntimeModel。 。在com.sun.xml.internal.ws.model.RuntimeModeler
|中672 | com.sun.xml.internal.ws.client.WSServiceDelegate中的createSEIPortInfo
| 660 | addSEI。 。 。 。 。 。 。 。在''
|中329 | getPort在''
|中312 | getPort。 。 。 。 。 。 。在''
|中294 | getPort在''
|中119 | getPort。 。 。 。 。 。 。在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 |索引。 。 。 。 。 。 。 。在grailsexample.WebserviceController
|中198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter。 。 。 。 。 。 。在grails.plugin.cache.web.filter.AbstractFilter
|中1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。 。 。 。 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
我不知道用哪个方法调用__execute方法。为什么它使用java调用很好,但在Grails项目中失败了?
更新:
-
请参阅知道这是关于Spring的类加载器问题。
-
我在使用GGTS IDE后添加
依赖:
compile:ws-client:1.0
到BuildConfig.groovy
但我仍然完全不知道原因。
我最近遇到了这个问题。
$ b
使用Grails 2.3.9,如果您将此依赖项放入BuildConfig.groovy中,问题似乎可以解决:
runtimecom.sun.xml.ws:jaxws-rt:2.1.7
或许,Grails环境默认情况下有一个较旧的JAX-WS运行时,所以需要更新一个。
另请参阅Alex Xu-s链接(在评论中)。
I use the wsimport to generate a Web service Client. Such like
wsimport -extension -keep -p [package] [wsdl file]
It works well by using it in java project.
But I want to invoke it in a Grails Project.So I put these generated classes by wsimport into the src/java folder.And I invoke it in "controllers" of Grails project such as
*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)*
Occur exception is
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
I don't know which method invoke __execute method. And why it works well by using java invoking, but it fails in Grails Project?
Update:
Refer the https://stackoverflow.com/questions/27317033/spring-wsdl-no-corresponding-wsdl-operation-with-name to know this is about classloader issue from Spring.
I used the GGTS IDE, after it add
Dependency:compile ":ws-client:1.0"
into BuildConfig.groovy
It works. But I still don't know the reason exactly.
I have bumped into this problem recently.
With a Grails 2.3.9, the problem seems to be solved if you place this dependency into sour BuildConfig.groovy:
runtime "com.sun.xml.ws:jaxws-rt:2.1.7"
Probably, the Grails environment has an older JAX-WS runtime by default, so a newer needs to be pulled in.
Also, see Alex Xu-s link (in comments).
这篇关于通过使用Grails项目中的wsimport generation java来调用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!