Web services in Grails

This article summarizes my experience with web services in Grails (and also Groovy). It will focus the on client side –
consuming web services. If you are looking for server size – providing services, you can use plugins like Metro or XFire.


Once you want to create a web service client in pure groovy, you do not have much options. I have found just two libraries: Groovy SOAP and Groovy WS.

The first one is a deprecated module, so one have to use the Groovy WS.

Sisyphean challenge


Making it running is a hard job. There are handy examples on the home page of the Groovy WS, but none of the examples was working. I spent significant amount of time to find out what is the problem. I was receiving this strange error message:

	Oct 26, 2008 9:48:19 PM org.apache.cxf.bus.spring.SpringBusFactory createBus
WARNING: Failed to create application context.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:881)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:837)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)

	blah blah blah

After investigation I did find that the problem is with libraries. The groovy WS library does not like xerces and xml-apis libraries.


The second difficulty was SSL. I do not remember details. It was somehow unable to download WSDL over SSL. It was necessary to download it and store into file system.


GroovyWS uses the Apache CXF libraries and they do not support RPC/Encoded web services.

java.lang.RuntimeException: Error compiling schema from WSDL at {https://my.url?wsdl}: undefined simple or complex type 'soapenc:Array' 
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory$InnerErrorListener.error(DynamicClientFactory.java:418)


I did not find the groovyWS to be a matured library. It is possible to use it for consuming web services, but only for the simplest ones. As soon as there is SSL, authentication… one have to use a “bigger hammer”. In my case, the hammer was Netbeans, that generated all the necessary classes.

Last, but not least. At the beginning I was not really sure what is the problem. I was suspecting the web services not to work correctly. So, I did use the soapUI testing tool to check that the web services are alive.


  1. I had the issue as your experience,
    about you mentioned the Library issue, could you describe more detail that how to solve?
    thanks a lot!

  2. Groovy-WS was a little too slow for my taste. It had trouble working with a more complex web service that I was trying to consume – it does work great for simple services microsoft braindumps.

    I do not think that there are any planned, major improvements to Groovy-WS. There are ways of consuming services using available web service plugins, but I had limited success with trying to implement them.

Comments are closed.