org.apache.axis2.client.Stub Java Examples

The following examples show how to use org.apache.axis2.client.Stub. 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: AuthenticateStub.java    From micro-integrator 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 #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: AuthenticateStub.java    From product-ei 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 #4
Source File: DeviceEventManagementServiceImpl.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
private void cleanup(Stub stub) {
    if (stub != null) {
        try {
            stub.cleanup();
        } catch (AxisFault axisFault) {
            log.warn("Failed to clean the stub " + stub.getClass());
        }
    }
}
 
Example #5
Source File: GeoLocationProviderServiceImpl.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
private void cleanup(Stub stub) {
    if (stub != null) {
        try {
            stub.cleanup();
        } catch (AxisFault axisFault) {
            //do nothing
        }
    }
}
 
Example #6
Source File: DeviceAnalyticsArtifactUploaderAdminServiceImpl.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
private void cleanup(Stub stub) {
    if (stub != null) {
        try {
            stub.cleanup();
        } catch (AxisFault axisFault) {
            //do nothing
        }
    }
}
 
Example #7
Source File: DeviceEventManagementServiceImpl.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
private void cleanup(Stub stub) {
    if (stub != null) {
        try {
            stub.cleanup();
        } catch (AxisFault axisFault) {
            log.warn("Failed to clean the stub " + stub.getClass());
        }
    }
}
 
Example #8
Source File: DeviceAnalyticsArtifactUploaderAdminServiceImpl.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
private void cleanup(Stub stub) {
    if (stub != null) {
        try {
            stub.cleanup();
        } catch (AxisFault axisFault) {
            //do nothing
        }
    }
}
 
Example #9
Source File: AuthenticateStub.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Stub authentication method
 *
 * @param stub          valid stub
 * @param sessionCookie session cookie
 */
public static void authenticateStub(String sessionCookie, Stub stub) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }
}
 
Example #10
Source File: BssClient.java    From development with Apache License 2.0 5 votes vote down vote up
/**
 * Ugly hack which only works due to the fact that the session server
 * doesn't verifiy the user's organization role
 * 
 * @param stub
 */
private void setBasicAuth(Stub stub) {
    HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
    basicAuth.setUsername(userKey);
    basicAuth.setPassword(password);
    basicAuth.setPreemptiveAuthentication(true);
    final Options clientOptions = stub._getServiceClient().getOptions();
    clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
}
 
Example #11
Source File: AuthenticateStub.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Stub authentication method
 *
 * @param stub          valid stub
 * @param sessionCookie session cookie
 */
public static void authenticateStub(String sessionCookie, Stub stub) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }
}
 
Example #12
Source File: SOAPEntitlementServiceClient.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
private void setAuthCookie(boolean isExpired, Stub stub, Authenticator authenticator)
        throws Exception {
    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
            authenticator.getCookie(isExpired));
}
 
Example #13
Source File: AuthenticateStubUtil.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Stub authentication method
 *
 * @param stub          valid stub
 * @param sessionCookie session cookie
 */
public static void authenticateStub(String sessionCookie, Stub stub) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }
}
 
Example #14
Source File: SSLUtils.java    From developer-studio with Apache License 2.0 5 votes vote down vote up
/**
 * Set the custom trust manager as the ssl protocol handler for the stub
 * 
 * @param stub
 * @throws Exception
 */
public static void setSSLProtocolHandler(Stub stub) throws Exception {
	init();
	stub._getServiceClient()
	    .getOptions()
	    .setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
	                 new Protocol("https", (ProtocolSocketFactory) new CustomSSLProtocolSocketFactory(sslCtx), 443));
}
 
Example #15
Source File: AuthenticateStubUtil.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Stub authentication method
 *
 * @param stub          valid stub
 * @param sessionCookie session cookie
 */
public static void authenticateStub(String sessionCookie, Stub stub) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }
}
 
Example #16
Source File: AuthenticateStubUtil.java    From product-cep with Apache License 2.0 5 votes vote down vote up
/**
 * Stub authentication method
 *
 * @param stub          valid stub
 * @param sessionCookie session cookie
 */
public static void authenticateStub(String sessionCookie, Stub stub) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }
}
 
Example #17
Source File: AuthenticateStubUtil.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Stub authentication method
 *
 * @param stub          valid stub
 * @param sessionCookie session cookie
 */
public static void authenticateStub(String sessionCookie, Stub stub) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }
}
 
Example #18
Source File: AbstractAPIGatewayAdminClient.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
/**
 * Log into the API gateway as an admin, and initialize the specified client stub using
 * the established authentication session. This method will also set some timeout
 * values and enable session management on the stub so that it can be successfully used
 * for any subsequent admin service invocations.
 * 
 * @param stub A client stub to be setup
 * @throws AxisFault if an error occurs when logging into the API gateway
 */
protected void setup(Stub stub, Environment environment) throws AxisFault {
    String cookie = login(environment);
    ServiceClient client = stub._getServiceClient();
    Options options = client.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 #19
Source File: SOAPEntitlementServiceClient.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void setAuthCookie(boolean isExpired, Stub stub, Authenticator authenticator) throws Exception {
    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
                       authenticator.getCookie(isExpired));
}
 
Example #20
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 #21
Source File: AuthenticateStub.java    From product-es with Apache License 2.0 5 votes vote down vote up
/**
 * Stub authentication method
 *
 * @param stub          valid stub
 * @param sessionCookie session cookie
 */
public static void authenticateStub(String sessionCookie, Stub stub) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }
}
 
Example #22
Source File: AuthenticateStubUtil.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Stub authentication method
 *
 * @param stub          valid stub
 * @param sessionCookie session cookie
 */
public static void authenticateStub(String sessionCookie, Stub stub) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }
}
 
Example #23
Source File: AuthenticatorClient.java    From product-es with Apache License 2.0 4 votes vote down vote up
public Stub getAuthenticationAdminStub() {
    return authenticationAdminStub;
}
 
Example #24
Source File: AuthenticatorClient.java    From product-ei with Apache License 2.0 4 votes vote down vote up
public Stub getServiceStub() {
    return this.authenticationAdminStub;
}
 
Example #25
Source File: AuthenticatorClient.java    From product-ei with Apache License 2.0 4 votes vote down vote up
public Stub getAuthenticationAdminStub() {
    return authenticationAdminStub;
}
 
Example #26
Source File: AuthenticatorClient.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public Stub getAuthenticationAdminStub() {
    return authenticationAdminStub;
}
 
Example #27
Source File: AuthenticatorClient.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public Stub getServiceStub() {
    return this.authenticationAdminStub;
}
 
Example #28
Source File: RetryParameter.java    From Java_NFe with MIT License 3 votes vote down vote up
/**
 * 
 * @param stub
 *            Client connection
 * @param retry
 *            Connection retry
 */
public static void populateRetry(Stub stub, Integer retry) {

    HttpMethodParams methodParams = new HttpMethodParams();

    methodParams.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(retry, retry != 0));

    stub._getServiceClient().getOptions().setProperty(HTTPConstants.HTTP_METHOD_PARAMS, methodParams);

}
 
Example #29
Source File: AuthenticateStub.java    From product-ei with Apache License 2.0 2 votes vote down vote up
/**
 * Authenticate the given web service stub against the Product user manager. This
 * will make it possible to use the stub for invoking Product admin services.
 *
 * @param stub Axis2 service stub which needs to be authenticated
 */
public static void authenticateStub(String userName, String password, Stub stub) {
    CarbonUtils.setBasicAccessSecurityHeaders(userName, password, stub._getServiceClient());
}
 
Example #30
Source File: AuthenticateStubUtil.java    From product-ei with Apache License 2.0 2 votes vote down vote up
/**
 * Authenticate the given web service stub against the Product user manager. This
 * will make it possible to use the stub for invoking Product admin services.
 *
 * @param stub Axis2 service stub which needs to be authenticated
 */
public static void authenticateStub(String userName, String password, Stub stub) {
    CarbonUtils.setBasicAccessSecurityHeaders(userName, password, stub._getServiceClient());
}