I am using the deprecated class OutflowConfiguration in order to set my
dynamic usernames and passwords in the OutflowSecurity parameter.  Below
are the methods that I use to do this.    

What is an alternative approach for me to set my username and password
dynamically?  What are my risks with launching this into production with
a deprecated class? 

This may be more specific to Rampart then Axis2, but I am hoping that
someone else has had this issue too.  Others have documented this
problem, but I have not found a viable solution.  

Thanks! 

////////////////////////////////////////////////////////
//////////////////////// getStub () ////////////////////
////////////////////////////////////////////////////////
    private PartnerAPIStub getStub() throws EmailException {
        PartnerAPIStub myStub = null;

        try {
            EndpointReference endPointReference = new
EndpointReference(endpoint);
            ConfigurationContext configurationContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                null, ABSOLUTE_AXIS2_CLIENT_CONFIG_PATH);

            myStub = new PartnerAPIStub(configurationContext, endpoint);
            ServiceClient serviceClient = myStub._getServiceClient();

            Options options = serviceClient.getOptions();

            options.setTo(endPointReference);

            this.updateOutflowSecurity(myStub);
        }
        catch (AxisFault e) {
            // TODO JL - temp code
            throw new EmailException(e);
        }

        return myStub;
    }

////////////////////////////////////////////////////////
////////////////// updateOutflowSecurity() /////////////
////////////////////////////////////////////////////////
private void updateOutflowSecurity(PartnerAPIStub stub) {

        ServiceClient serviceClient = stub._getServiceClient();
        Options options = serviceClient.getOptions();

        OutflowConfiguration ofc = new OutflowConfiguration();
        ofc.setActionItems("UsernameToken");
        ofc.setUser(apiUsername); 
        ofc.setPasswordType("PasswordText");

        options.setProperty(WSSHandlerConstants.OUTFLOW_SECURITY,
ofc.getProperty());

         //pwcbhandler is of type PWCBHandler that is injected via
Spring 
       options.setProperty(WSHandlerConstants.PW_CALLBACK_REF,
pwcbhandler);
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to