// Rampart module should be in the repository 
//acquire ConfigurationContext
        ConfigurationContext ctx = 
ConfigurationContextFactory.createConfigurationContextFromFileSystem("path/to/client",
 null);

//acquire a stub to the deployed Service on secure port 8443                
        SecureServiceStub stub = new 
SecureServiceStub(ctx,"https://localhost:8443/axis2/services/SecureService";);

//acquire the client                
        ServiceClient sc = stub._getServiceClient();

//engageModule                
        sc.engageModule("rampart");
                
        Options options = sc.getOptions();
        options.setUserName("apache");
        options.setPassword("password");             sc.setOptions(options);
        //fill the Payload with the actual request
             OMElement response = sc.sendReceive(getPayload("Hello world"));

*Saludos Cordiales desde EEUU*
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




Date: Tue, 7 Jul 2009 14:13:26 -0500
Subject: Re: Setting Username/password Programaticly
From: [email protected]
To: [email protected]

Hi Nandana,
Don't mind my last message, reading carefully I've found everything I need in 
the example you provide..
Thanks again.

___________________________
Marcus Sánchez Díaz.
Enterprise Developer.
SCJP - SCWCD.



On Tue, Jul 7, 2009 at 1:10 PM, m4rkuz <[email protected]> wrote:

Hi Nandana,
I can't help to ask if there is a way to dynamically set the user and password 
w/o having a password call back handler... is there any?

Thanks for your your valuable input.

___________________________
Marcus Sánchez Díaz.
Enterprise Developer.
SCJP - SCWCD.



On Tue, Jul 7, 2009 at 11:56 AM, Nandana Mihindukulasooriya 
<[email protected]> wrote:


Hi Marcus,
          You are using the deprecated configuration of Apache Rampart. Apache 
Rampart recommends policy based configuration. The latter option only works 
with policy based configuration. If you have the option of moving in to policy 
based configuration, following tutorials might help you.




Web Services Security with Apache Rampart - Part 1 (Transport Level Security)
Understanding WS - Security Policy Language




thanks,
Nandana

On Mon, Jul 6, 2009 at 7:29 PM, m4rkuz <[email protected]> wrote:




Hi Everyone,
I'm trying to set username/password dynamically on my ws app I've googled a lot 
and find some workarounds but the only one that has worked for me contains 
deprecated code, and used a password call back handler that really mess with 
what i want to do, this is the code:




                OutflowConfiguration outflowConfig = new OutflowConfiguration();
                outflowConfig.setActionItems("UsernameToken");




                outflowConfig.setUser("username");
                outflowConfig



                                
.setPasswordCallbackClass("com.xxx.xxx.security.PWCBHandler");
                outflowConfig.setPasswordType("PasswordText");




                
_serviceClient.getOptions().setProperty(WSSHandlerConstants.OUTFLOW_SECURITY,   
outflowConfig.getProperty());





This works like a charm but I have to search for the username/password in base 
of some parameters I won't have available in the PWDCBHandler class, so what 
I'm looking for is a way to set the password directly w/o using a password call 
back handler.




About this I've found some code that claims to do so:
                 _serviceClient.getOptions().setUserName("15374159");



                                  
_serviceClient.getOptions().setPassword("admin123");

but it''s not working for me...
Any Ideas?
I would really appreciate your input,

Thanks in advance,





___________________________
Marcus Sánchez Díaz.
Enterprise Developer.
SCJP - SCWCD.

SCDJWS on going...


-- 
Nandana Mihindukulasooriya  
WSO2 inc.

http://nandana83.blogspot.com/


http://www.wso2.org






_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits. 
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009

Reply via email to