I've implemented a small client against a partners soap-backend using the excellent ws-lite library
Unfortunately the library does not come with logging support afaik, but I found this blog which describes how to delegate using functional composition.
Now I would like to add logging for all types of send methods on the original SoapClient class. I am sure that it's possible with some Groovy metaprogramming black magic, but I haven't found any example on how to do so and I'm still a noob when it comes to dynamic metaprogramming. What I'd like is to add methods with the same signatures which invokes the logging and error handling before delegating to the original ones.
I'd also like to have this in only one place to keep me DRY and without needing to adapt to any possible future overloaded versions when the API evolves.
The SOAPClient has send methods such as:
public SOAPResponse send(java.util.Map requestParams, groovy.lang.Closure content)
public SOAPResponse send(java.util.Map requestParams, java.lang.String content)
public SOAPResponse send(java.util.Map requestParams, wslite.soap.SOAPVersion soapVersion, java.lang.String content)
Now I could just extend the class, override the methods and go on with my life. But I'd like to know the Groovier (and future proof) way to achieve this.