简体   繁体   中英

Invoke a web service by using wsimport generation java from Grails Project

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:

  1. Refer the https://stackoverflow.com/questions/27317033/spring-wsdl-no-corresponding-wsdl-operation-with-name to know this is about classloader issue from Spring.

  2. 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM