Being fairly new to Grails i was wondering what people use to consume a webservice in Grails projects. So the client side of the system? Any recommendations? I see people using GroovyWS, Spring-WS etc.. What is a good and easy on to use?
GroovyWS is very easy to use and has great documentation I would definitely recommend it.
Using Grails CXF plugin here. Needed:
DynamicClientFactoryit changed a current classloader;Besides that, the consumer code is pretty slim.
Edit: sorry, no more then this, and I'm not sure I'm not breaking and NDA yet:
#1:
def arrayOfLong = objectFactory.createArrayOfLong(XXX, ids)
result = client.invoke(methodName, arrayOfLong as Object[])
#2:
def dcf = DynamicClientFactory.newInstance()
def classLoader = Thread.currentThread().getContextClassLoader()
// create a WS client
// and assign end point address to it
def client = dcf.createClient(WSDL_URL, classLoader)
client.conduit.target.address.setValue(endpointUrl)
// reacquire classloader because 'createClient' changes it
def changedClassLoader = Thread.currentThread().getContextClassLoader()
def objectFactory = changedClassLoader.
loadClass(FACTORY_CLASS_NAME).newInstance()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With