I am having trouble trying to use a web service from a groovy script. I am using WSClient lib.
If I followed the example posted on the groovy website:
@Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.2') import groovyx.net.ws.WSClient proxy = new WSClient("http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", this.class.classLoader) proxy.initialize() result = proxy.CelsiusToFahrenheit(0) println "You are probably freezing at ${result} degrees Farhenheit"
It works fine, but as soon as I try to use another service, it crashes this error:
INFO: Created classes: javac: no source files Usage: javac use -help to list possible options 07-jul-2010 9:55:57 org.apache.cxf.endpoint.dynamic.DynamicClientFactory createC lient GRAVE: failed to compile java files for http: // xxx: 8080 / x / services / xxx? wsdl . Caught: groovyx.net.ws.exceptions.InvokeException: java.lang.NullPointerExceptio n on groovy -ws.run (groovy -ws.groovy: 13)
The code is exactly the same (except for the wsdl URL, which corresponds to one internal server). The main difference between the two is that the second wsdl is the RPC style, and the first is not. I read that there are some problems to consume RPC, such as webservices from groovy using the WSClient lib. ΒΏDoes anyone know how to consume RPC, for example, webservices with WSClient? Can someone enlighten me please?
Many thanks
source share