private void setAdminCookie(boolean result) { if (result) { String cookie = (String) stub._getServiceClient().getServiceContext().getProperty( HTTPConstants.COOKIE_STRING); if (cookie == null) { // For local transport - the cookie will be null. // This generated cookie cannot be used for any form authentication with the backend. // This is done to be backward compatible. cookie = UUID.randomUUID().toString(); } session.setAttribute(ServerConstants.ADMIN_SERVICE_AUTH_TOKEN, cookie); } }
public static Stub authenticateStub(Stub stub, String sessionCookie, String backendURL) { long soTimeout = 5 * 60 * 1000; // Five 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); 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; }
public ConfigurationContext getConfigurationContext() { return activityAdminServiceStub._getServiceClient().getServiceContext().getConfigurationContext(); } }
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; }
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; }
public ConfigurationContext getConfigurationContext() { return activityAdminServiceStub._getServiceClient().getServiceContext().getConfigurationContext(); } }
public ConfigurationContext getConfigurationContext() { return activityAdminServiceStub._getServiceClient().getServiceContext().getConfigurationContext(); } }
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; }
public static Stub authenticateStub(Stub stub, String sessionCookie, String backendURL) { // Three minutes long soTimeout = 5 * 60 * 1000; 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); option.setTo(new EndpointReference( backendURL + client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", ""))); return stub; }
public ConfigurationContext getConfigurationContext() { return activityAdminServiceStub._getServiceClient().getServiceContext().getConfigurationContext(); } }
/** * Constructor that takes in a configContext * @param configurationContext configurationContext * @param targetEndpoint targetEndpoint * @throws org.apache.axis2.AxisFault in case of error */ public IMAGEPROXYStub(org.apache.axis2.context.ConfigurationContext configurationContext, java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault { // To populate AxisService populateAxisService(); populateFaults(); _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext, _service); configurationContext = _serviceClient.getServiceContext().getConfigurationContext(); _serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(targetEndpoint)); }
MessageContext getInputMessageContext() throws XdsInternalException, AxisFault { if (operationClient == null) { Object in = serviceClient.getServiceContext() .getLastOperationContext().getMessageContexts().get("In"); if (!(in instanceof MessageContext)) throw new XdsInternalException( "Soap: In MessageContext of type " + in.getClass().getName() + " instead of MessageContext"); MessageContext inMsgCxt = (MessageContext) in; return inMsgCxt; } return operationClient.getMessageContext("In"); }
private static void fillSOAPEnvelope(MessageContext messageContext, OMElement xmlPayload, ServiceClient serviceClient) throws AxisFault { messageContext.setServiceContext(serviceClient.getServiceContext()); SOAPFactory soapFactory = getSOAPFactory(serviceClient.getOptions()); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); if (xmlPayload != null) { envelope.getBody().addChild(xmlPayload); } serviceClient.addHeadersToEnvelope(envelope); messageContext.setEnvelope(envelope); }
/** Constructor that takes in a configContext @param configurationContext configurationContext @param targetEndpoint targetEndpoint @throws org.apache.axis2.AxisFault in case of error */ public AuthorityServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext, java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault { //To populate AxisService populateAxisService(); populateFaults(); _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service); configurationContext = _serviceClient.getServiceContext().getConfigurationContext(); _serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference( targetEndpoint)); _serviceClient.getOptions().setTimeOutInMilliSeconds(1000000000); } /**
/** * Constructor that takes in a configContext and useseperate listner */ public GlobalAdminServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext, java.lang.String targetEndpoint, boolean useSeparateListener) throws org.apache.axis2.AxisFault { //To populate AxisService populateAxisService(); populateFaults(); _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service); configurationContext = _serviceClient.getServiceContext().getConfigurationContext(); _serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference( targetEndpoint)); _serviceClient.getOptions().setUseSeparateListener(useSeparateListener); //Set the soap version _serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); }
/** Constructor that takes in a configContext @param configurationContext configurationContext @param targetEndpoint targetEndpoint @throws org.apache.axis2.AxisFault in case of error */ public ActorServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext, java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault { //To populate AxisService populateAxisService(); populateFaults(); _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service); configurationContext = _serviceClient.getServiceContext().getConfigurationContext(); _serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference( targetEndpoint)); _serviceClient.getOptions().setTimeOutInMilliSeconds(1000000000); } /**
public void stop() { if (serviceClient != null) { // close all connections that we have initiated, so that the jetty server // can be restarted without seeing ConnectExceptions HttpClient httpClient = (HttpClient)serviceClient.getServiceContext().getConfigurationContext() .getProperty(HTTPConstants.CACHED_HTTP_CLIENT); if (httpClient != null) ((MultiThreadedHttpConnectionManager)httpClient.getHttpConnectionManager()).shutdown(); serviceClient = null; } }
public boolean authenticate(ConfigurationContext ctx, String serverURL, String username, String password) throws AxisFault, AuthenticationException { String serviceEPR = serverURL + "AuthenticationAdmin"; authenticationAdminStub = new AuthenticationAdminStub(ctx, serviceEPR); ServiceClient client = authenticationAdminStub._getServiceClient(); Options options = client.getOptions(); options.setManageSession(true); try { boolean result = authenticationAdminStub.login(username, password, new URL(serviceEPR).getHost()); if (result){ setCookie((String) authenticationAdminStub._getServiceClient().getServiceContext(). getProperty(HTTPConstants.COOKIE_STRING)); } return result; } catch (Exception e) { String msg = "Error occurred while logging in"; throw new AuthenticationException(msg, e); } }
/** * Users can get a SequenceReport of the sequence defined by the information * given from the passed serviceClient object. * * @param serviceClient * @return * @throws SandeshaException */ public static SequenceReport getOutgoingSequenceReport(ServiceClient serviceClient) throws SandeshaException { ServiceContext serviceContext = serviceClient.getServiceContext(); if (serviceContext == null) throw new SandeshaException(SandeshaMessageHelper.getMessage( SandeshaMessageKeys.serviceContextNotSet)); ConfigurationContext configurationContext = serviceContext.getConfigurationContext(); String internalSequenceID = getInternalSequenceIdFromServiceClient(serviceClient); return getOutgoingSequenceReport(internalSequenceID, configurationContext); }
void setMaxConnections() { MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); params.setDefaultMaxConnectionsPerHost(50); params.setMaxTotalConnections(50); params.setSoTimeout(20000); params.setConnectionTimeout(20000); multiThreadedHttpConnectionManager.setParams(params); HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); serviceClient.getServiceContext().getConfigurationContext().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); }