Grails and consume SOAP webservice?

Using grails cxf plugin here. Needed: classloader workaround - DynamicClientFactoryit changed a current classloader; and to code WS invocations by hand. 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().

I was under the impression that cxf is used for providing webservices and not consuming. Why is the classloader workaround needed? Could you give also a small example on how you code the WS invocation?

Thanks a lot! – Marco Mar 28 at 8:50 Well, we're both providing and consuming, and tried to keep to one dependency. – Victor Sergienko Mar 28 at 9:22 I am trying both Groovy WS and the CXF approach, I generated my client using wsdl2java, placed the generated code inside the java folder and am now stumbling on the fact that I do not know what JAR files I need to copy into my lib folder to get things compiling succesfully.

– Marco Apr 15 at 13:01 Sorry, can't help you - I don't see your generated code's dependencies. We never used wsdl2java - our code is all dynamic. The client we use is created in a line dcf.

CreateClient(WSDL_URL, classLoader). – Victor Sergienko Apr 15 at 13:04.

GroovyWS is very easy to use and has great documentation I would definitely recommend it.

It seems indeed very easy! – Marco Apr 15 at 12:59.

Using Grails 1.3.7 I am consuming my own web service with WS-Client Grails plugin. It is actually based on GroovyWS, which in turn uses CXF. It is very easy to use at least in my simple scenario, where I only get Strings from the backend web service.

I have no idea how it works with complex data types yet though. I had never consumed or created a webservice before but using that plugin in the frontend and the Grails CXF plugin in the backend I got a SOAP discussion between my grails apps in two days. You don't really need to use CXF or GroovyWS directly with the very nice ws-client plugin.

Speed (of development) and simplicity.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions