private EntitlementServiceStub getEntitlementStub(String serverUrl) throws Exception { if (entitlementStub.containsKey(serverUrl)) { return entitlementStub.get(serverUrl); } EntitlementServiceStub stub; ConfigurationContext configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } stub = new EntitlementServiceStub(configurationContext, serverUrl + "EntitlementService"); entitlementStub.put(serverUrl, stub); return stub; }
private EntitlementServiceStub getEntitlementStub(String serverUrl) throws Exception { if (entitlementStub.containsKey(serverUrl)) { return entitlementStub.get(serverUrl); } EntitlementServiceStub stub; ConfigurationContext configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } stub = new EntitlementServiceStub(configurationContext, serverUrl + "EntitlementService"); entitlementStub.put(serverUrl, stub); return stub; }
private EntitlementPolicyAdminServiceStub getEntitlementAdminStub(String serverUrl) throws Exception { if (policyAdminStub.containsKey(serverUrl)) { return policyAdminStub.get(serverUrl); } EntitlementPolicyAdminServiceStub stub; ConfigurationContext configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } stub = new EntitlementPolicyAdminServiceStub(configurationContext, serverUrl + "EntitlementPolicyAdminService"); policyAdminStub.put(serverUrl, stub); return stub; }
private EntitlementPolicyAdminServiceStub getEntitlementAdminStub(String serverUrl) throws Exception { if (policyAdminStub.containsKey(serverUrl)) { return policyAdminStub.get(serverUrl); } EntitlementPolicyAdminServiceStub stub; ConfigurationContext configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } stub = new EntitlementPolicyAdminServiceStub(configurationContext, serverUrl + "EntitlementPolicyAdminService"); policyAdminStub.put(serverUrl, stub); return stub; }
/** * Initializes TransportSenders and TransportListeners with appropriate configuration information * * @param configContext : ConfigurationContext */ private static void initTransportSenders(ConfigurationContext configContext) { AxisConfiguration axisConf = configContext.getAxisConfiguration(); // Initialize Transport Outs HashMap transportOuts = axisConf.getTransportsOut(); Iterator values = transportOuts.values().iterator(); while (values.hasNext()) { TransportOutDescription transportOut = (TransportOutDescription) values.next(); TransportSender sender = transportOut.getSender(); if (sender != null) { try { sender.init(configContext, transportOut); } catch (AxisFault axisFault) { log.info(Messages.getMessage("transportiniterror", transportOut.getName())); } } } }
/** * Initializes TransportSenders and TransportListeners with appropriate configuration information * * @param configContext : ConfigurationContext */ private static void initTransportSenders(ConfigurationContext configContext) { AxisConfiguration axisConf = configContext.getAxisConfiguration(); // Initialize Transport Outs HashMap transportOuts = axisConf.getTransportsOut(); Iterator values = transportOuts.values().iterator(); while (values.hasNext()) { TransportOutDescription transportOut = (TransportOutDescription) values.next(); TransportSender sender = transportOut.getSender(); if (sender != null) { try { sender.init(configContext, transportOut); } catch (AxisFault axisFault) { log.info(Messages.getMessage("transportiniterror", transportOut.getName())); } } } }
private void initConfigurationContext() throws Exception { HttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); File configFile = new File(DEFAULT_AXIS2_XML); if (!configFile.exists()) { configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); configurationContext.setProperty(HTTPConstants.DEFAULT_MAX_CONNECTIONS_PER_HOST, MAX_CONNECTIONS_PER_HOST); } else { configurationContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem(DEFAULT_CLIENT_REPO, DEFAULT_AXIS2_XML); } configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); configurationContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE); Map<String, TransportOutDescription> transportsOut = configurationContext.getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { if (Constants.TRANSPORT_HTTP.equals(transportOutDescription.getName()) || Constants.TRANSPORT_HTTPS.equals(transportOutDescription.getName())) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } } }
private void initConfigurationContext() throws Exception { HttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); File configFile = new File(DEFAULT_AXIS2_XML); if (!configFile.exists()) { configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); configurationContext.setProperty(HTTPConstants.DEFAULT_MAX_CONNECTIONS_PER_HOST, MAX_CONNECTIONS_PER_HOST); } else { configurationContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem(DEFAULT_CLIENT_REPO, DEFAULT_AXIS2_XML); } configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); configurationContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE); Map<String, TransportOutDescription> transportsOut = configurationContext.getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { if (Constants.TRANSPORT_HTTP.equals(transportOutDescription.getName()) || Constants.TRANSPORT_HTTPS.equals(transportOutDescription.getName())) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } } }
public void addTransport(TransportInDescription trpInDesc, TransportOutDescription trpDescOut) throws AxisFault { cfgCtx.getAxisConfiguration().addTransportIn(trpInDesc); if (trpDescOut != null) { trpDescOut.getSender().init(cfgCtx, trpDescOut); cfgCtx.getAxisConfiguration().addTransportOut(trpDescOut); } }
/** * @param realmConfig * @param properties * @throws Exception */ public CarbonRemoteUserStoreManger(RealmConfiguration realmConfig, Map properties) throws Exception { ConfigurationContext configurationContext = ConfigurationContextFactory .createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } String[] serverUrls = realmConfig.getUserStoreProperty(SERVER_URLS).split(","); for (int i = 0; i < serverUrls.length; i++) { remoteUserStore = new WSUserStoreManager( realmConfig.getUserStoreProperty(REMOTE_USER_NAME), realmConfig.getUserStoreProperty(PASSWORD), serverUrls[i], configurationContext); if (log.isDebugEnabled()) { log.debug("Remote Servers for User Management : " + serverUrls[i]); } remoteServers.put(serverUrls[i], remoteUserStore); } this.realmConfig = realmConfig; domainName = realmConfig.getUserStoreProperty(UserStoreConfigConstants.DOMAIN_NAME); }
public void addTransport(TransportInDescription trpInDesc, TransportOutDescription trpDescOut) throws AxisFault { cfgCtx.getAxisConfiguration().addTransportIn(trpInDesc); if (trpDescOut != null) { trpDescOut.getSender().init(cfgCtx, trpDescOut); cfgCtx.getAxisConfiguration().addTransportOut(trpDescOut); } }
public void addTransport(TransportInDescription trpInDesc, TransportOutDescription trpDescOut) throws AxisFault { cfgCtx.getAxisConfiguration().addTransportIn(trpInDesc); if (trpDescOut != null) { trpDescOut.getSender().init(cfgCtx, trpDescOut); cfgCtx.getAxisConfiguration().addTransportOut(trpDescOut); } }
private boolean authenticate() throws Exception { ConfigurationContext configurationContext; configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } boolean isAuthenticated = false; if (StringUtils.isNotEmpty(userName) && StringUtils.isNotEmpty(password)) { //if authorized cookie is not available authorize using credentials AuthenticationAdminStub authAdmin = new AuthenticationAdminStub(configurationContext, serverUrl); isAuthenticated = authAdmin.login(userName, password, "localhost"); cookie = (String) authAdmin._getServiceClient().getServiceContext() .getProperty(HTTPConstants.COOKIE_STRING); authAdmin._getServiceClient().cleanupTransport(); } else if (StringUtils.isNotEmpty(authorizedCookie)) { //when authorized cookie is available assign it to local variable isAuthenticated = true; cookie = authorizedCookie; } return isAuthenticated; }
private void enableCGTransportSender(AxisConfiguration axisConfig) throws Exception { CGTransportSender sender = new CGTransportSender(); TransportOutDescription transportOut = new TransportOutDescription(CGConstant.CG_TRANSPORT_NAME); transportOut.setSender(sender); axisConfig.addTransportOut(transportOut); transportOut.getSender().init(getConfigContext(), transportOut); }
private boolean authenticate() throws Exception { ConfigurationContext configurationContext; configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); Map<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } boolean isAuthenticated = false; if (StringUtils.isNotEmpty(userName) && StringUtils.isNotEmpty(password)) { //if authorized cookie is not available authorize using credentials AuthenticationAdminStub authAdmin = new AuthenticationAdminStub(configurationContext, serverUrl); isAuthenticated = authAdmin.login(userName, password, "localhost"); cookie = (String) authAdmin._getServiceClient().getServiceContext() .getProperty(HTTPConstants.COOKIE_STRING); authAdmin._getServiceClient().cleanupTransport(); } else if (StringUtils.isNotEmpty(authorizedCookie)) { //when authorized cookie is available assign it to local variable isAuthenticated = true; cookie = authorizedCookie; } return isAuthenticated; }
public void testInit() throws AxisFault { ConfigurationContext confContext = ConfigurationContextFactory .createEmptyConfigurationContext(); TransportOutDescription transportOut = new TransportOutDescription("http"); TransportSender sender = getTransportSender(); sender.init(confContext, transportOut); }
/** * Initialize the rest client and set username and password of the user * * @param serverURL server URL * @param username username * @param password password * @throws AxisFault */ private void initializeRestClient(String serverURL, String username, String password) throws AxisFault { HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator(); authenticator.setUsername(username); authenticator.setPassword(password); authenticator.setPreemptiveAuthentication(true); ConfigurationContext configurationContext; try { configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); } catch (Exception e) { String msg = "Backend error occurred. Please contact the service admins!"; throw new AxisFault(msg, e); } HashMap<String, TransportOutDescription> transportsOut = configurationContext .getAxisConfiguration().getTransportsOut(); for (TransportOutDescription transportOutDescription : transportsOut.values()) { transportOutDescription.getSender().init(configurationContext, transportOutDescription); } this.restClient = new RestClient(serverURL, username, password); }
headerList.add(header2); msgContext.setProperty(HTTPConstants.HTTP_HEADERS, headerList); sender.init(confContext, transportOut); InvocationResponse inResponse = sender.invoke(msgContext); assertEquals("Not the expected InvocationResponse", InvocationResponse.CONTINUE, inResponse);
axisCfg.addTransportOut(trpOutDesc); sender = trpOutDesc.getSender(); sender.init(cfgCtx, trpOutDesc);
axisCfg.addTransportOut(trpOutDesc); sender = trpOutDesc.getSender(); sender.init(cfgCtx, trpOutDesc);