Hi Brain, I just realized that you are using Axis1. Sorry for the misunderstanding.
The code you had sent will was for Axis2, I have this working under Axis2 1.4.1 with Rampart 1.4. Unfortunately I have no experience with Axis1 so I can't help you any further. Regards, Leander > -----Ursprüngliche Nachricht----- > Von: brianfm [mailto:bfmur...@gmail.com] > Gesendet: Dienstag, 27. Januar 2009 18:18 > An: axis-user@ws.apache.org > Betreff: Re: setting username/password in soap header programmatically > > > Hi, > > thanks to everyone again who has replied. > I would prefer not to add custom headers to the soap message, i want to > use > the ws-security usernametoken. > Thanks Leander for your response, but that approach did not work. > In the wss4j documentation, is the following code snippit. > Unfortunately, it is not clear on which object the _setPropery in on - > its > is not on any generation code from wsdl2java or in the apit: > > PingServiceLocator service = new PingServiceLocator(); > ... > PingPort port = (PingPort) service.getPing1(); > port._setProperty(UsernameToken.PASSWORD_TYPE, > WSConstants.PASSWORD_TEXT); > port._setProperty(WSHandlerConstants.USER, "werner"); > > This is from the package description of org.apache.ws.axis.security. > > I had success with the following approach , but all these classes are > deprecated, and no alternative is suggested in the api. > > OutflowConfiguration outflowConfig = new > OutflowConfiguration(); > > > outflowConfig.setActionItems("UsernameToken"); > > > outflowConfig.setUser("bob"); > > > outflowConfig.setPasswordCallbackClass("test1.security.PWCBClientHandle > r"); > > > axisstub._getServiceClient().getOptions().setProperty(WSSHandlerConstan > ts.OUTFLOW_SECURITY, > > > outflowConfig.getProperty()); > > I am trying to attempt something basic here, unfortunately the api doc > is > quite poor. > Any ideas? > > Brian > > brianfm wrote: > > > > Hi, > > > > My application requires that I programmatically set a username and > > password into the ws-security standard locations in the soap header. > Note > > that I do not want to configure Rampart athentication because > > authentication logic will be fully proprietery in the server. > > I intend to just retrieve the usename/password from soap header > > programmtically from server and then authenticate. > > > > thanks, > > > > Brian > > > > -- > View this message in context: http://www.nabble.com/setting-username- > password-in-soap-header-programmatically-tp21641020p21689872.html > Sent from the Axis - User mailing list archive at Nabble.com. VVA Networks GmbH Mario-Leander Reimer Dipl.-Inf. (FH) Teamleitung Publishing Solutions --------------------------------------------------------------------------- VVA Networks GmbH : medien mit zukunft Geisenhausenerstraße 15-17 81379 München Deutschland --------------------------------------------------------------------------- Fon: +49 89 2000375-610 Fax: +49 89 2000375-699 Mobil: +49 173 5883541 --------------------------------------------------------------------------- leander.rei...@vva-networks.de www.vva-networks.de ----------------------------------------------------------------------- HRB 33884 Düsseldorf Geschäftsführer Rolf Christian Kassel ----------------------------------------------------------------------- Ein Unternehmen der VVA Kommunikation http://www.vva.de ----------------------------------------------------------------------- omnisuite® - integrate. automate. communicate. http://www.omnisuite.de ----------------------------------------------------------------------- Diese Nachricht (inklusive aller Anhänge) ist vertraulich. Sie darf ausschließlich durch den vorgesehenen Empfänger und Adressaten gelesen, kopiert oder genutzt werden. Sollten Sie diese Nachricht versehentlich erhalten haben, bitten wir, den Absender (durch Antwort-E-Mail) hiervon unverzüglich zu informieren und die Nachricht zu löschen. Jede unerlaubte Nutzung oder Weitergabe des Inhalts dieser Nachricht, sei es vollständig oder teilweise, ist unzulässig. This message (including any attachments) is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error please contact the sender (by return E-Mail) immediately and delete this message. Any unauthorised use or dissemination of this message in whole or in part is strictly prohibited.