Apache Axis: How to set call properties using code generated from wsdl2java?
I'm using Apache Axis 1.4 (yes, the old one), with wsdl2java to generate the client code for a webservice. I'd like to set additional properties on the Call object before calling methods on the generated stub.
For example, I'd like to set username, password, perhaps add or modify existing headers, and change the client handlers to use different implementations.
Currently, I'm doing this by modifying the generated Stub class and calling the appropriate setters. However, I'd like to achieve this without touching the generated files. I"m confused, though, because the Stub class has:
createCall()
which creates the call object and sets some properties. Currently, this is where I'm modifying the generated source code; then, the Stub contains:
clientMethod1(){
blahblah
Call _call = createCall();
......
_call.invoke();
}
So I can't see a way that I can use the serviceLocator to get a stub, modify the prope开发者_如何学JAVArties I want to modify, and then use the stub to call the methods I want to call, given that the stub methods call createCall() and then call invoke. There doesn't appear to be a way to intercept the new Call object before it's invoked.
So: How do you modify properties in the call without modifying the generated Stub class's source code?
Thanks for info or even pointers to existing documentation.
I wouldn't like to touch the generated code too. The risk is that I once have to regenerate it and loose my edits.
Without knowing axis details - isn't it possible to subclass the Stub and override 'createCall'? Axis won't touch this subclass and you could set your properties in the overridden createCall method
精彩评论