Java Code Examples for javax.xml.ws.BindingProvider.PASSWORD_PROPERTY

The following are Jave code examples for showing how to use PASSWORD_PROPERTY of the javax.xml.ws.BindingProvider class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: oscm-app   File: BesDAO.java   Source Code and License Vote up 5 votes
String getPasswordConstant(Map<String, Setting> settings) {
    if (isSsoMode(settings)) {
        return "password";
    } else {
        return BindingProvider.PASSWORD_PROPERTY;
    }

}
 
Example 2
Project: oscm   File: BesDAO.java   Source Code and License Vote up 5 votes
String getPasswordConstant(Map<String, Setting> settings) {
    if (isSsoMode(settings)) {
        return "password";
    } else {
        return BindingProvider.PASSWORD_PROPERTY;
    }

}
 
Example 3
Project: oscm   File: BSSWebServiceFactory.java   Source Code and License Vote up 4 votes
/**
 * Creates a OSCM Web service with the given parameters.
 * 
 * @param serviceClass
 *            the class of the Web service to be created
 * @param authentication
 *            a <code>PasswordAuthentication</code> object specifying the
 *            credentials to be used for authentication
 * @return the service class
 * @throws ConfigurationException
 *             if the configuration of the platform is incorrect
 * @throws MalformedURLException
 *             if the base URL of the OSCM configuration is malformed
 */
public static <T> T getBSSWebService(Class<T> serviceClass,
        PasswordAuthentication authentication)
        throws ConfigurationException, MalformedURLException {

    String targetNamespace = serviceClass.getAnnotation(WebService.class)
            .targetNamespace();
    QName serviceQName = new QName(targetNamespace,
            serviceClass.getSimpleName());

    String wsdlUrl = APPlatformServiceFactory.getInstance()
            .getBSSWebServiceWSDLUrl();
    wsdlUrl = wsdlUrl.replace("{SERVICE}", serviceClass.getSimpleName());
    String serviceUrl = APPlatformServiceFactory.getInstance()
    .getBSSWebServiceUrl();
    serviceUrl=serviceUrl.replace("{SERVICE}", serviceClass.getSimpleName());
    Service service = Service.create(new URL(wsdlUrl), serviceQName);

    boolean isSsoMode = wsdlUrl != null
            && wsdlUrl.toLowerCase().endsWith("/sts?wsdl");
    String portSuffix = isSsoMode ? "PortSTS" : "PortBASIC";

    T client = service.getPort(
            new QName(targetNamespace, serviceClass.getSimpleName()
                    + portSuffix), serviceClass);

    String usernameConstant = isSsoMode ? "username"
            : BindingProvider.USERNAME_PROPERTY;
    String passwordConstant = isSsoMode ? "password"
            : BindingProvider.PASSWORD_PROPERTY;

    Map<String, Object> clientRequestContext = ((BindingProvider) client)
            .getRequestContext();
    clientRequestContext
            .put(usernameConstant, authentication.getUserName());
    clientRequestContext
            .put(passwordConstant, authentication.getPassword());
    clientRequestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            serviceUrl );
    return client;
}