org.apache.axis.client.Stub now has a setHeader/getHeader
-- dims
--- "Dunn, Scott" <[EMAIL PROTECTED]> wrote:
> Last year I wrote a service using an earlier version of Axis that passed
> authentication information via the header. To access the header I had to
> manually modify the generated client stub as in the example below.
> This is far from ideal as I have to make the same modification everytime the
> WSDL file is updated and the stub is regenerated.
>
> I think I could create my own code gen factory and have it invoke my own
> subclass of JavaStubWriter which would generate the code below along with
> appropriate setters that would allow the USER and PASSWORD properties to be
> set, however as I also want to be able to hand this off to other users I
> don't want to have to send them updates everytime Axis is rev'd and
> therefore the stub client potentially changed.
>
> Ideally, I would be able to invoke something like
> stub.addHeaderProperty(propName, propValue).
>
> Any ideas on the most appropriate way to manipulate the header without
> having to modify the generated stub?
>
> Thanks,
>
> Scott.
>
> private org.apache.axis.client.Call createCall() throws
> java.rmi.RemoteException {
> try {
> org.apache.axis.client.Call _call =
> (org.apache.axis.client.Call)
> super.service.createCall();
>
> org.apache.axis.message.SOAPHeaderElement user =
> new org.apache.axis.message.SOAPHeaderElement("", "USER");
> user.setObjectValue("foo");
> _call.addHeader(user);
> org.apache.axis.message.SOAPHeaderElement password =
> new org.apache.axis.message.SOAPHeaderElement("", "PASSWORD");
> password.setObjectValue("bar");
> _call.addHeader(password);
>
=====
Davanum Srinivas - http://webservices.apache.org/~dims/
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/