Java Code Examples for org.apache.axis2.client.ServiceClient#getOptions()

The following examples show how to use org.apache.axis2.client.ServiceClient#getOptions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WSRealm.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
/**
 * Initialize WSRealm by Non-carbon environment
 */
void init(String url, String cookie, ConfigurationContext configCtxt)
        throws UserStoreException {
    try {

        stub = new RemoteUserRealmServiceStub(configCtxt, url + REALM_SERVICE_NAME);

        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
        option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
                this
                        .getSessionCookie());
    } catch (AxisFault e) {

        throw new UserStoreException("Axis error occurred while creating service client stub");
    }

    userStoreMan = new WSUserStoreManager(url, cookie, configCtxt);
    authzMan = new WSAuthorizationManager(url, cookie, configCtxt);
    claimManager = new WSClaimManager(url, cookie, configCtxt);
    profileManager = new WSProfileConfigurationManager(url, cookie, configCtxt);
}
 
Example 2
Source File: AuthenticateStub.java    From product-es with Apache License 2.0 6 votes vote down vote up
public static Stub authenticateStub(Stub stub, String sessionCookie, String backendURL) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    System.out.println("XXXXXXXXXXXXXXXXXXX" +
                       backendURL +  client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", ""));
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    option.setTo(new EndpointReference(backendURL +  client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", "")));
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }

    return stub;
}
 
Example 3
Source File: UserProfileCient.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
public UserProfileCient(String cookie, String url,
                        ConfigurationContext configContext) throws java.lang.Exception {
    try {
        this.serviceEndPoint = url + "UserProfileMgtService";
        stub = new UserProfileMgtServiceStub(configContext, serviceEndPoint);

        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
        option
                .setProperty(
                        org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
                        cookie);
    } catch (java.lang.Exception e) {
        log.error(e);
        throw e;
    }
}
 
Example 4
Source File: WorkflowDeployerClient.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
public WorkflowDeployerClient(String bpsURL, String username, char[] password) throws AxisFault {
    bpelUploaderStub = new BPELUploaderStub(bpsURL + BPEL_UPLOADER_SERVICE);
    ServiceClient serviceClient = bpelUploaderStub._getServiceClient();
    Options options = serviceClient.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(username);
    auth.setPassword(new String(password));
    auth.setPreemptiveAuthentication(true);
    List<String> authSchemes = new ArrayList<>();
    authSchemes.add(HttpTransportProperties.Authenticator.BASIC);
    auth.setAuthSchemes(authSchemes);
    options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    serviceClient.setOptions(options);

    humanTaskUploaderStub = new HumanTaskUploaderStub(bpsURL + HT_UPLOADER_SERVICE);
    ServiceClient htServiceClient = humanTaskUploaderStub._getServiceClient();
    Options htOptions = htServiceClient.getOptions();
    htOptions.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    htServiceClient.setOptions(htOptions);
}
 
Example 5
Source File: ApplicationAdminClient.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public ApplicationAdminClient(String cookie,
                          String backendServerURL,
                          ConfigurationContext configCtx,
                          Locale locale) throws AxisFault {
    String serviceURL = backendServerURL + "ApplicationAdmin";
    bundle = ResourceBundle.getBundle(BUNDLE, locale);

    stub = new ApplicationAdminStub(configCtx, serviceURL);
    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
    option.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
}
 
Example 6
Source File: TierCacheInvalidationClient.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
public void clearCache(String tenantDomain, String serverURL, String cookie) throws AxisFault, RemoteException {
    TierCacheServiceStub tierCacheServiceStub;

    ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
    tierCacheServiceStub = getTierCacheServiceStub(serverURL, ctx);
    ServiceClient client = tierCacheServiceStub._getServiceClient();
    Options options = client.getOptions();
    options.setTimeOutInMilliSeconds(TIMEOUT_IN_MILLIS);
    options.setProperty(HTTPConstants.SO_TIMEOUT, TIMEOUT_IN_MILLIS);
    options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, TIMEOUT_IN_MILLIS);
    options.setManageSession(true);
    options.setProperty(HTTPConstants.COOKIE_STRING, cookie);

    tierCacheServiceStub.invalidateCache(tenantDomain);
}
 
Example 7
Source File: SCIMConfigAdminClient.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiate SCIMConfigAdminClient
 *
 * @param cookie
 * @param backendServerURL
 * @param configContext
 */
public SCIMConfigAdminClient(String cookie, String backendServerURL,
                             ConfigurationContext configContext) throws AxisFault {
    String serviceURL = backendServerURL + "SCIMConfigAdminService";
    stub = new SCIMConfigAdminServiceStub(configContext, serviceURL);
    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
}
 
Example 8
Source File: WSProfileConfigurationManager.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public WSProfileConfigurationManager(String serverUrl, String cookie,
                                     ConfigurationContext configCtxt) throws UserStoreException {
    try {
        stub =
                new RemoteProfileConfigurationManagerServiceStub(configCtxt, serverUrl +
                        SERVICE_NAME);
        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
        option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
    } catch (AxisFault e) {

        throw new UserStoreException("Axis error occurred while creating service client stub",e);
    }
}
 
Example 9
Source File: ClaimMetadataMgtServiceClient.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates ClaimMetadataMgtServiceClient
 *
 * @param cookie           For session management
 * @param backendServerURL URL of the back end server where ClaimManagementServiceStub is running.
 * @param configCtx        ConfigurationContext
 * @throws                 AxisFault if error occurs when instantiating the stub
 */
public ClaimMetadataMgtServiceClient(String cookie, String backendServerURL, ConfigurationContext configCtx)
        throws AxisFault {

    String serviceURL = backendServerURL + "ClaimMetadataManagementService";
    stub = new ClaimMetadataManagementServiceStub(configCtx, serviceURL);
    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
}
 
Example 10
Source File: ReportResourceSupplierClient.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public ReportResourceSupplierClient(String cookie,
                                   String backEndServerURL,
                                   ConfigurationContext configCtx
                                   ) throws AxisFault {
    String serviceURL = backEndServerURL + "ReportingResourcesSupplier";


    stub = new ReportingResourcesSupplierStub(configCtx, serviceURL);
    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
}
 
Example 11
Source File: EntitlementServiceClient.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates EntitlementServiceClient
 *
 * @param cookie           For session management
 * @param backendServerURL URL of the back end server where EntitlementService is running.
 * @param configCtx        ConfigurationContext
 * @throws org.apache.axis2.AxisFault
 */
public EntitlementServiceClient(String cookie, String backendServerURL,
                                ConfigurationContext configCtx) throws AxisFault {
    String serviceURL = backendServerURL + "EntitlementService";
    stub = new EntitlementServiceStub(configCtx, serviceURL);
    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
}
 
Example 12
Source File: FunctionLibraryManagementServiceClient.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates FunctionLibraryManagementServiceClient.
 *
 * @param cookie           For session management
 * @param backendServerURL URL of the back end server where FunctionLibraryManagementAdminServiceStub is running
 * @param configCtx        ConfigurationContext
 * @throws AxisFault
 */
public FunctionLibraryManagementServiceClient(String cookie, String backendServerURL,
                                              ConfigurationContext configCtx) throws AxisFault {

    String serviceURL = backendServerURL + FUNCTION_LIBRARY_MANAGEMENT_SERVICE;
    stub = new FunctionLibraryManagementAdminServiceStub(configCtx, serviceURL);

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setProperty(HTTPConstants.COOKIE_STRING, cookie);
}
 
Example 13
Source File: ConfigurationUtil.java    From product-cep with Apache License 2.0 5 votes vote down vote up
private void initEventReceiverAdminServiceClient(
        String backendURL,
        String loggedInSessionCookie)
        throws AxisFault {
    eventReceiverAdminServiceClient = new EventReceiverAdminServiceClient(backendURL, loggedInSessionCookie);
    ServiceClient client = eventReceiverAdminServiceClient._getServiceClient();
    Options options = client.getOptions();
    options.setManageSession(true);
    options.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, loggedInSessionCookie);
}
 
Example 14
Source File: TopicAdminClient.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void configureCookie(ServiceClient client) throws AxisFault {
    if(SessionCookie != null){
        Options option = client.getOptions();
        option.setManageSession(true);
        option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
                SessionCookie);
    }
}
 
Example 15
Source File: TopicAdminClient.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Adding session cookie to service client options
 *
 * @param client the service client
 * @throws AxisFault
 */
private void configureCookie(ServiceClient client) throws AxisFault {
    if (SessionCookie != null) {
        Options option = client.getOptions();
        option.setManageSession(true);
        option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
                           SessionCookie);
    }
}
 
Example 16
Source File: UserInformationRecoveryClient.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public UserInformationRecoveryClient(String cookie, String url, ConfigurationContext configContext) throws AxisFault {
    try {
        stub = new UserInformationRecoveryServiceStub(configContext, url + "UserInformationRecoveryService");
        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
        option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
    } catch (java.lang.Exception e) {
        handleException(e.getMessage(), e);
    }
}
 
Example 17
Source File: UserStoreConfigAdminServiceClient.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor UserStoreConfigAdminServiceClient
 *
 * @param cookie
 * @param backendServerURL
 * @param configContext
 */
public UserStoreConfigAdminServiceClient(String cookie, String backendServerURL,
                                         ConfigurationContext configContext) throws AxisFault {
    String serviceURL = backendServerURL + "UserStoreConfigAdminService";
    stub = new UserStoreConfigAdminServiceStub(configContext, serviceURL);
    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
}
 
Example 18
Source File: KeyStoreAdminClient.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public KeyStoreAdminClient(String cookie, String url, ConfigurationContext configContext)
        throws java.lang.Exception {
    try {
        this.serviceEndPoint = url + "KeyStoreAdminService";
        this.stub = new KeyStoreAdminServiceStub(configContext, serviceEndPoint);
        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
        option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
    } catch (AxisFault e) {
        log.error("Error in creating KeyStoreAdminClient", e);
        throw e;
    }

}
 
Example 19
Source File: LocalEntryAdminClient.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
protected final void setup(Stub stub, Environment environment, ConfigurationContext configurationContext) throws AxisFault {
    String cookie = gatewayLogin(environment, configurationContext);
    ServiceClient serviceClient = stub._getServiceClient();
    Options options = serviceClient.getOptions();
    options.setTimeOutInMilliSeconds(15 * 60 * 1000);
    options.setProperty(HTTPConstants.SO_TIMEOUT, 15 * 60 * 1000);
    options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, 15 * 60 * 1000);
    options.setManageSession(true);
    options.setProperty(HTTPConstants.COOKIE_STRING, cookie);

}
 
Example 20
Source File: FileUploadServiceClient.java    From attic-stratos with Apache License 2.0 5 votes vote down vote up
public FileUploadServiceClient(ConfigurationContext ctx,
                               String serverURL,
                               String cookie) throws AxisFault {
    String serviceEPR = serverURL + "FileUploadService";
    stub = new FileUploadServiceStub(ctx, serviceEPR);
    ServiceClient client = stub._getServiceClient();
    Options options = client.getOptions();
    options.setManageSession(true);
    if (cookie != null) {
        options.setProperty(HTTPConstants.COOKIE_STRING, cookie);
    }
    options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
}