List of usage examples for javax.xml.ws BindingProvider PASSWORD_PROPERTY
String PASSWORD_PROPERTY
To view the source code for javax.xml.ws BindingProvider PASSWORD_PROPERTY.
Click Source Link
From source file:org.pentaho.platform.plugin.services.importexport.CommandLineProcessor.java
/** * Why does this return a web service? Going directly to the IUnifiedRepository requires the following: * <p/>/*from w w w. java 2 s . co m*/ * <ul> * <li>PentahoSessionHolder setup including password and tenant ID. (The server doesn't even process passwords today-- * it assumes that Spring Security processed it. This would require code changes.)</li> * <li>User must specify path to Jackrabbit files (i.e. system/jackrabbit).</li> * </ul> */ protected synchronized IUnifiedRepository getRepository() throws ParseException { if (repository != null) { return repository; } final String NAMESPACE_URI = "http://www.pentaho.org/ws/1.0"; //$NON-NLS-1$ final String SERVICE_NAME = "unifiedRepository"; //$NON-NLS-1$ String urlString = getOptionValue( Messages.getInstance().getString("CommandLineProcessor.INFO_OPTION_URL_KEY"), Messages.getInstance().getString("CommandLineProcessor.INFO_OPTION_URL_NAME"), true, false).trim(); if (urlString.endsWith("/")) { urlString = urlString.substring(0, urlString.length() - 1); } urlString = urlString + "/webservices/" + SERVICE_NAME + "?wsdl"; URL url; try { url = new URL(urlString); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } Service service = Service.create(url, new QName(NAMESPACE_URI, SERVICE_NAME)); IUnifiedRepositoryJaxwsWebService port = service.getPort(IUnifiedRepositoryJaxwsWebService.class); // http basic authentication ((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, getOptionValue(Messages.getInstance().getString("CommandLineProcessor.INFO_OPTION_USERNAME_KEY"), Messages.getInstance().getString("CommandLineProcessor.INFO_OPTION_USERNAME_NAME"), true, false)); ((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, getOptionValue(Messages.getInstance().getString("CommandLineProcessor.INFO_OPTION_PASSWORD_KEY"), Messages.getInstance().getString("CommandLineProcessor.INFO_OPTION_PASSWORD_NAME"), true, true)); // accept cookies to maintain session on server ((BindingProvider) port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true); // support streaming binary data // TODO mlowery this is not portable between JAX-WS implementations // (uses com.sun) ((BindingProvider) port).getRequestContext().put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192); SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding(); binding.setMTOMEnabled(true); final UnifiedRepositoryToWebServiceAdapter unifiedRepositoryToWebServiceAdapter = new UnifiedRepositoryToWebServiceAdapter( port); repository = unifiedRepositoryToWebServiceAdapter; return unifiedRepositoryToWebServiceAdapter; }
From source file:org.qualipso.funkyfactory.test.clock.ws.ClockServiceWSTest.java
/** * Test the getTime WebService factory service authentified *//*from ww w . j a v a 2 s. co m*/ @Test public void testGetTimeAuthentified() { logger.debug("Testing ClockService WebService authentified"); Map<String, Object> reqContext = ((BindingProvider) service).getRequestContext(); reqContext.put(StubExt.PROPERTY_AUTH_TYPE, StubExt.PROPERTY_AUTH_TYPE_WSSE); reqContext.put(BindingProvider.USERNAME_PROPERTY, "kermit"); reqContext.put(BindingProvider.PASSWORD_PROPERTY, "thefrog"); messageTest(); }