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?  Why was the OutflowConfiguration class deprecated?  

 

Others have documented this problem, but I have not found a viable
solution that makes sense.  

 

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);

    }

 

Reply via email to