I have used WSClient on my Grails application by adding groovyws-standalone-0.3.1.jar in lib folder of my project. Added the following code in my controller:
import groovyx.net.ws.WSClient
....
....
def wsdlUrl = "url_Of_webservice?wsdl"
def payLoad = "list_Of_Parameters"
def result = ''
def proxy = new WSClient(wsdlUrl , this.class.classLoader)
try{
proxy.initialize()
result = proxy.getallvendorsbyurl(payLoad)
}
catch (java.lang.NullPointerException e){
println "proxy not initialize"
}
It is working fine in localhost but when i deploy it on tomcat6 server, it starts throwing exception :
On server logs:
ERROR errors.GrailsExceptionResolver - groovy.lang.GroovyObjectSupport
java.lang.ClassNotFoundException: groovy.lang.GroovyObjectSupport
On GSP page:
Error 500: Executing action [groupDetails] of controller [com.ongraph.yhd.GroupController] caused exception: java.lang.NoClassDefFoundError: groovy/lang/GroovyObjectSupport
Servlet: grails
URI: /grails/group/groupDetails.dispatch
Exception Message: groovy.lang.GroovyObjectSupport
Caused by:groovy.lang.GroovyObjectSupport
Class:GroupController
At Line: [758] (groupController->line-758->def wsdlUrl = "url_Of_webservice?wsdl")
I have also gone through the below mentioned link but no luck :(
I have used grails ws-client plugin and it worked like a charm.