Ok just for my Understanding...
If I create a
then the ClassLoader defined by cl should be used to generate the classes from the WSDL...
This means the classes for example a Map<String,Object> (Which accords to the type package.String2AnyType) should be loadable trough this ClassLoader...
so I could override the create Method like:
class FixedWSClient extends WSClient{
public FixedWSClient(String wsdlLocation, ClassLoader classloader) {
super(wsdlLocation,classloader)
}
public Object create(String classname) {
classloader.loadClass(classname).newInstance()
}
}
the create Method from this class than will be used...
However I get a java.lang.ClassNotFoundException Exception
To be sure that cxf won't use a different I instantiate the FixedWSClient like this
def cl = new GroovyClassLoader()
client = cl.loadClass("package.FixedWSClient").newInstance(url,cl)
client.initialize()
I also tried to set the Thread.currentThread().contextClassLoader = cl
Nothing helps...
any Idea or explanations on this behaviour?
We've got the same issue which we have a non-elegant work where we store the classloader (Thread.currentThread().getContextClassLoader() ) used for initialisation and reuse for class creation, e.g.
initialise
proxy=new WSClient("http://terraservice.net/TerraService.asmx?WSDL", this.class.classLoader)
proxy.initialize()
classLoader=Thread.currentThread().getContextClassLoader()
method call
def place = classLoader.loadClass("com.terraserver_usa.terraserver.Place").newInstance()
place.city = city
place.state = state
place.country = country
proxy.ConvertPlaceToLonLatPt(place)
See http://bemoko.googlecode.com/svn/sites/exercise_webservice_soap/trunk/plugins/LocationPlugin.groovy