Apache Axis: How to set call properties using code generated from wsdl2java?

Posted by marc esher on Stack Overflow See other posts from Stack Overflow or by marc esher
Published on 2010-01-23T20:28:58Z Indexed on 2010/03/23 18:03 UTC
Read the original article Hit count: 451

Filed under:
|
|
|

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 properties 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.

© Stack Overflow or respective owner

Related posts about java

Related posts about axis