What is the standard SOAP library to use in groovy?
Asked Answered
S

4

15

I just need a SOAP client to make remote calls, but I'm a bit of a Groovy noob. According to the Groovy documentation, the standard Groovy SOAP library is deprecated. Instead, the docs point you to a newer library: GroovyWS.

Unfortunately, GroovyWS has a warning that says the project is dormant and it then points you to Groovy WSLite.

Groovy WSLite actually still appears to be under active development, but not very 'Groovy-ish' compared to the previous 2 libraries. Is wslite what everyone is using?

Stallfeed answered 16/5, 2012 at 15:22 Comment(1)
My requirements for the project that spawned this question changed, so I didn't actually try the libraries suggested by @john-wagenleitner but his answer seemed the most complete as an answer to my question. Thanks everyone for the answers!Stallfeed
M
13

I think you would find both GroovyWS and groovy-wslite (and HTTP Builder) are in use as Groovy SOAP client libraries in projects and the decision was probably one of which one worked and which one had the API/approach the user preferred (in that order).

My advice would be to give GroovyWS a try if you like the API it provides and its ability to proxy a WSDL document and see if it works for the services you need to interact with. Things have not changed much in the SOAP world so I would not worry too much about how recently it has been updated. If it works then you are done, if you experience some issues that you are not able to readily find help for then I would try the alternatives.

groovy-wslite (disclaimer: I'm the author) aims to provide a lightweight (in terms of dependencies) alternative that trades the convenience of WSDL parsing/proxying for making it easier to have more control over the resulting soap call without having to dig deep into the internals of some underlying Java framework like CXF. Some prefer having the additional features of a library built on top of a framework like this while others may prefer the simplicity of the other approach.

The thing that makes Groovy so great is how easy it is to integrate with Java. So, as others have already pointed out, you can integrate with Java web service clients like Spring WS, CXF, and JAX-WS pretty easily.

Manet answered 19/5, 2012 at 16:57 Comment(0)
T
2

I'd stay way clear of groovyws, it sucks. After looking around I finally chose the solution of using spring web services and contract-driven web services.

The client instantiates command objects with a toXml() method that generates the soap request XML. Then use the WebServiceTemplate to sendToEndpoint.

For the server, we use spring web services endpoints. Parsing the incoming xml is child's play, and you don't need to marshal the XML into an object, as the GPathResult resulting from an XmlSlurper is totally manageable. Our server runs on top of grails, so we took advantage of the springws grails plugin, making the creation of Endpoints even easier.

There is one caveat though. The springws plugin for grails is out of date. Spring web services is now version 2.x and springws plugin comes with 1.4.x i think. However, it is very easy to use without the plugin, and I think that upgrading the plugin to the newer api is not hard.

Also, if you want to do MTOM, springws gets a little more complicated, because you need to dig deeper into the message handling. I was able to do some pretty advanced ws-security stuff with spring web services however, no problem.

Otherwise i would use cxf (handles MTOM nicely), if you want to stick with jax-ws et al. The overhea is probably higher, because all the dynamically generated proxies and pojos. Also, it is not contract-driven, which is a big plus for us.

http://predic8.com/groovy-web-services-jax-ws.htm

http://cxf.apache.org/docs/how-do-i-develop-a-client.html

Tambour answered 16/5, 2012 at 22:40 Comment(1)
FWIW, 4 years later, and migrating away from SOAP, I'd give groovy wslite a shot, for residual web services clients. Building server endpoints, I'd have to study the field again. Please take my answer in context of 2012.Radiator
O
0

Looks like you have done the homework yourslef! Groovy WS Lite seems to be currently working one. If you want to see spring-ws in action using Groovy, then here is a test suite project I had created in github.

Olva answered 18/5, 2012 at 3:21 Comment(0)
M
0

Or you can use JSON instead. SOAP is quite antiquated. The links above for groovy documentation and GroovyWS go nowhere

Morly answered 6/9, 2018 at 19:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.