org.apache.axis2.client.ServiceClient Java Examples
The following examples show how to use
org.apache.axis2.client.ServiceClient.
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: UserProfileCient.java From carbon-identity with Apache License 2.0 | 6 votes |
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 #2
Source File: LoadbalanceFailoverClient.java From product-ei with Apache License 2.0 | 6 votes |
public LoadbalanceFailoverClient() { String repositoryPath = System.getProperty(ESBTestConstant.CARBON_HOME) + File.separator + "samples" + File.separator + "axis2Client" + File.separator + "client_repo"; File repository = new File(repositoryPath); log.info("Using the Axis2 repository path: " + repository.getAbsolutePath()); try { cfgCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem( repository.getCanonicalPath(), null); serviceClient = new ServiceClient(cfgCtx, null); log.info("Sample clients initialized successfully..."); } catch (Exception e) { log.error("Error while initializing the StockQuoteClient", e); } }
Example #3
Source File: SecureSample.java From micro-integrator with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { String epr = "https://" + HOST_IP + ":" + HOST_HTTPS_PORT + "/services/samples/SecureDataService"; System.setProperty("javax.net.ssl.trustStore", (new File(CLIENT_JKS_PATH)).getAbsolutePath()); ConfigurationContext ctx = ConfigurationContextFactory .createConfigurationContextFromFileSystem(null, null); SecureDataServiceStub stub = new SecureDataServiceStub(ctx, epr); ServiceClient client = stub._getServiceClient(); Options options = client.getOptions(); client.engageModule("rampart"); options.setUserName("admin"); options.setPassword("admin"); options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(SECURITY_POLICY_PATH)); Office[] offices = stub.showAllOffices(); for (Office office : offices) { System.out.println("\t-----------------------------"); System.out.println("\tOffice Code: " + office.getOfficeCode()); System.out.println("\tPhone: " + office.getPhone()); System.out.println("\tAddress Line 1: " + office.getAddressLine1()); System.out.println("\tAddress Line 2: " + office.getAddressLine2()); System.out.println("\tCity: " + office.getCity()); System.out.println("\tState: " + office.getState()); System.out.println("\tPostal Code: " + office.getPostalCode()); System.out.println("\tCountry: " + office.getCountry()); } }
Example #4
Source File: IWAUIAuthenticator.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * @param request * @return * @throws AxisFault */ private IWAAuthenticatorStub getIWAClient(HttpServletRequest request) throws AxisFault, IdentityException { HttpSession session = request.getSession(); ServletContext servletContext = session.getServletContext(); String backendServerURL = request.getParameter("backendURL"); if (backendServerURL == null) { backendServerURL = CarbonUIUtil.getServerURL(servletContext, request.getSession()); } ConfigurationContext configContext = (ConfigurationContext) servletContext .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); String serviceEPR = backendServerURL + "IWAAuthenticator"; IWAAuthenticatorStub stub = new IWAAuthenticatorStub(configContext, serviceEPR); ServiceClient client = stub._getServiceClient(); client.engageModule("rampart"); Policy rampartConfig = IdentityBaseUtil.getDefaultRampartConfig(); Policy signOnly = IdentityBaseUtil.getSignOnlyPolicy(); Policy mergedPolicy = signOnly.merge(rampartConfig); Options options = client.getOptions(); options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, mergedPolicy); options.setManageSession(true); return stub; }
Example #5
Source File: Sample704TestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = { "wso2.esb" }, description = "RESTful Invocations with Message Forwarding" + " Processor test case") public void messageStoreFIXStoringTest() throws Exception { ServiceClient serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(getBackEndServiceUrl("StockQuoteProxy"))); options.setAction("urn:placeOrder"); options.setProperty(Constants.Configuration.TRANSPORT_URL, getMainSequenceURL()); serviceClient.setOptions(options); for (int i = 0; i < 10; i++) { serviceClient.sendRobust(createPayload()); } Thread.sleep(2000); Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0, "Messages are stored"); }
Example #6
Source File: SubscriptionCreationWSWorkflowExecutorTest.java From carbon-apimgt with Apache License 2.0 | 6 votes |
@Test public void testWorkflowCleanupTask() throws Exception { WorkflowDTO workflowDTO = new WorkflowDTO(); workflowDTO.setWorkflowReference("1"); workflowDTO.setExternalWorkflowReference(UUID.randomUUID().toString()); ServiceReferenceHolderMockCreator serviceRefMock = new ServiceReferenceHolderMockCreator(-1234); ServiceReferenceHolderMockCreator.initContextService(); PowerMockito.whenNew(ServiceClient.class) .withArguments(Mockito.any(ConfigurationContext.class), Mockito.any(AxisService.class)) .thenReturn(serviceClient); try { subscriptionCreationWSWorkflowExecutor.cleanUpPendingTask(workflowDTO.getExternalWorkflowReference()); } catch (WorkflowException e) { Assert.fail("Error while calling the cleanup task"); } }
Example #7
Source File: UserSignUpWorkflowExecutorTest.java From carbon-apimgt with Apache License 2.0 | 6 votes |
@Before public void init() throws Exception { ServiceReferenceHolder serviceReferenceHolder = TestUtils.getServiceReferenceHolder(); RealmService realmService = Mockito.mock(RealmService.class); UserRealm userRealm = Mockito.mock(UserRealm.class); userStoreManager = Mockito.mock(UserStoreManager.class); PowerMockito.mockStatic(CarbonUtils.class); userAdminStub = Mockito.mock(UserAdminStub.class); userRegistrationAdminServiceStub = Mockito.mock(UserRegistrationAdminServiceStub.class); serviceClient = Mockito.mock(ServiceClient.class);; PowerMockito.whenNew(UserAdminStub.class).withAnyArguments().thenReturn(userAdminStub); PowerMockito.whenNew(UserRegistrationAdminServiceStub.class).withAnyArguments().thenReturn (userRegistrationAdminServiceStub); PowerMockito.when(userRegistrationAdminServiceStub._getServiceClient()).thenReturn(serviceClient); Mockito.when(serviceClient.getOptions()).thenReturn(new Options()); Mockito.when(serviceReferenceHolder.getRealmService()).thenReturn(realmService); Mockito.when(realmService.getBootstrapRealm()).thenReturn(userRealm); Mockito.when(userRealm.getUserStoreManager()).thenReturn(userStoreManager); PowerMockito.doNothing().when(CarbonUtils.class, "setBasicAccessSecurityHeaders", Mockito.anyString(), Mockito.anyString(), Mockito.anyBoolean(), (ServiceClient) Mockito.anyObject()); FlaggedName flaggedName = new FlaggedName(); flaggedName.setSelected(true); flaggedName.setItemName(role); flaggedNames = new FlaggedName[]{flaggedName}; }
Example #8
Source File: SecureAxisServiceClient.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * @param userName * @param password * @param endpointReference * @param operation * @param payload * @param securityPolicyPath * @param userCertAlias * @param encryptionUser * @param keyStorePath * @param keyStorePassword * @throws Exception */ public void sendRobust(String userName, String password, String endpointReference, String operation, OMElement payload, String securityPolicyPath, String userCertAlias, String encryptionUser, String keyStorePath, String keyStorePassword) throws Exception { ServiceClient sc = getServiceClient(userName, password, endpointReference, operation, securityPolicyPath, userCertAlias, encryptionUser, keyStorePath, keyStorePassword); if (log.isDebugEnabled()) { log.debug("payload :" + payload); log.debug("Security Policy Path :" + securityPolicyPath); log.debug("Operation :" + operation); log.debug("username :" + userName); log.debug("password :" + password); } log.info("Endpoint reference :" + endpointReference); try { sc.sendRobust(payload); } catch (AxisFault axisFault) { log.error("AxisFault : " + axisFault.getMessage()); throw axisFault; } finally { sc.cleanupTransport(); } }
Example #9
Source File: Sample704TestCase.java From product-ei with Apache License 2.0 | 6 votes |
@Test(groups = { "wso2.esb" }, description = "RESTful Invocations with Message Forwarding" + " Processor test case") public void messageStoreFIXStoringTest() throws Exception { ServiceClient serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(getBackEndServiceUrl("StockQuoteProxy"))); options.setAction("urn:placeOrder"); options.setProperty(Constants.Configuration.TRANSPORT_URL, getMainSequenceURL()); serviceClient.setOptions(options); for (int i = 0; i < 10; i++) { serviceClient.sendRobust(createPayload()); } Thread.sleep(2000); Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0, "Messages are stored"); }
Example #10
Source File: ServiceChainingTest.java From product-ei with Apache License 2.0 | 6 votes |
@Test(groups = {"wso2.esb"}) public void testTenantIDInTenantResponsePath() throws Exception { // create a tenant TenantManagementServiceClient tenantMgtAdminServiceClient = new TenantManagementServiceClient(contextUrls.getBackEndUrl(), sessionCookie); tenantMgtAdminServiceClient.addTenant("t5.com", "jhonporter", "jhon", "demo"); // log as tenant AuthenticatorClient authClient = new AuthenticatorClient(contextUrls.getBackEndUrl()); String session = authClient.login("[email protected]", "jhonporter", "localhost"); // load configuration in tenant space esbUtils.loadESBConfigurationFrom("artifacts/ESB/ServiceChainingConfig.xml", contextUrls.getBackEndUrl(), session); // Create service client ServiceClient sc = getServiceClient("http://localhost:8480/services/t/t5.com/ServiceChainingProxy", null, "wso2"); sc.fireAndForget(createStandardSimpleRequest("wso2")); // Get logs by tenant name LogViewerClient logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), sessionCookie); ArrayList<LogEvent> logs = Utils.getLogsWithExpectedValue(logViewerClient, "INFO", "RECEIVE"); Assert.assertNotNull(logs, "Expected logs were not found"); LogEvent receiveSeqLog_1 = getLogEventByMessage(logs, "DEBUG SEQ 1 = FIRST RECEIVE SEQUENCE"); Assert.assertNotNull(receiveSeqLog_1); LogEvent receiveSeqLog_2 = getLogEventByMessage(logs, "DEBUG SEQ 2 = SECOND RECEIVE SEQUENCE"); Assert.assertNotNull(receiveSeqLog_2); }
Example #11
Source File: SOAPClient.java From product-ei with Apache License 2.0 | 6 votes |
/** * Sends a SOAP message with MTOM attachment and returns response as a OMElement. * * @param fileName name of file to be sent as an attachment * @param targetEPR service url * @param soapAction SOAP Action to set. Specify with "urn:" * @return OMElement response from BE service * @throws AxisFault in case of an invocation failure */ public OMElement sendSOAPMessageWithAttachment(String fileName, String targetEPR, String soapAction) throws AxisFault { OMFactory factory = OMAbstractFactory.getOMFactory(); OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0"); OMElement payload = factory.createOMElement("uploadFileUsingMTOM", ns); OMElement request = factory.createOMElement("request", ns); OMElement image = factory.createOMElement("image", ns); FileDataSource fileDataSource = new FileDataSource(new File(fileName)); DataHandler dataHandler = new DataHandler(fileDataSource); OMText textData = factory.createOMText(dataHandler, true); image.addChild(textData); request.addChild(image); payload.addChild(request); ServiceClient serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(targetEPR)); options.setAction(soapAction); options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); options.setCallTransportCleanup(true); serviceClient.setOptions(options); return serviceClient.sendReceive(payload); }
Example #12
Source File: ParallelRequestHelper.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * constructor for parallel request helper * we can use this for the initial begin boxcarring request as well.(sending sessionCookie null) * * @param sessionCookie * @param operation * @param payload * @param serviceEndPoint * @throws org.apache.axis2.AxisFault */ public ParallelRequestHelper(String sessionCookie, String operation, OMElement payload, String serviceEndPoint) throws AxisFault { this.payload = payload; sender = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(serviceEndPoint)); options.setProperty("__CHUNKED__", Boolean.FALSE); options.setTimeOutInMilliSeconds(45000L); options.setAction("urn:" + operation); sender.setOptions(options); if (sessionCookie != null && !sessionCookie.isEmpty()) { Header header = new Header("Cookie", sessionCookie); ArrayList headers = new ArrayList(); headers.add(header); sender.getOptions().setProperty(HTTPConstants.HTTP_HEADERS, headers); } }
Example #13
Source File: WSRealmTenantManager.java From carbon-identity with Apache License 2.0 | 6 votes |
private RemoteTenantManagerServiceStub getStub() throws UserStoreException { if (stub == null) { try { stub = new RemoteTenantManagerServiceStub(UserMgtWSAPIDSComponent .getCcServiceInstance().getClientConfigContext(), url + SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); LoginSender sender = new LoginSender(); String sessionCookie = sender.login(); if (sessionCookie == null) { throw new UserStoreException(SERVER_LOGIN_ERROR); } option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie); } catch (AxisFault axisFault) { throw new UserStoreException("Axis error occurred while creating service client stub",axisFault); } } return stub; }
Example #14
Source File: DirectoryServerManagerClient.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
public DirectoryServerManagerClient(String cookie, String url, ConfigurationContext configContext) throws ServerManagerClientException { try { stub = new DirectoryServerManagerStub(configContext, url + SERVER_MANAGER_SERVICE); 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("Unable to instantiate DirectoryServerManagerClient.", e); throw new ServerManagerClientException(ServerManagerClientException.INIT_SERVICE_PRINCIPLE_ERROR, e); } }
Example #15
Source File: AuthenticateStubUtil.java From product-ei with Apache License 2.0 | 5 votes |
/** * 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: RegistrytStoredQueryTest.java From openxds with Apache License 2.0 | 5 votes |
@Test public void testGetDocumentsAndAssociations() throws Exception { //1. Submit a document first for a random patientId String patientId = generateAPatientId(); String uuid = submitOneDocument(patientId); //2. Generate StoredQuery request message String message = GetDocumentsQuery(uuid, false,"urn:uuid:bab9529a-4a10-40b3-a01f-f68a615d247a"); OMElement request = OMUtil.xmlStringToOM(message); System.out.println("Request:\n" +request); //3. Send a StoredQuery ServiceClient sender = getRegistryServiceClient(); OMElement response = sender.sendReceive( request ); assertNotNull(response); //4. Verify the response is correct OMAttribute status = response.getAttribute(new QName("status")); assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); //5. Verify that the given PatientId is found from the StoredQuery response. NodeList nodes = getPatientIdNodes(response, patientId, "getDocuments"); assertTrue(nodes.getLength() == 1); //6. Verify that the Association object found from the StoredQuery response. NodeList nodes1 = getPatientIdNodes(response, patientId, "getAssociations"); assertTrue(nodes1.getLength() == 1); String result = response.toString(); System.out.println("Result:\n" +result); }
Example #17
Source File: ClusterAdminClient.java From carbon-commons with Apache License 2.0 | 5 votes |
public ClusterAdminClient(String cookie, String backendServerURL, ConfigurationContext configCtx, Locale locale) throws AxisFault { String serviceURL = backendServerURL + "ClusterAdmin"; bundle = ResourceBundle.getBundle(BUNDLE, locale); stub = new ClusterAdminStub(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 #18
Source File: RegistrytStoredQueryTest.java From openxds with Apache License 2.0 | 5 votes |
@Test public void testFindDocuments() throws Exception { //1. Submit a document first for a random patientId String patientId = generateAPatientId(); String uuid = submitOneDocument(patientId); //2. Generate StoredQuery request message String message = findDocumentsQuery(patientId, "Approved"); OMElement request = OMUtil.xmlStringToOM(message); System.out.println("Request:\n" +request); //3. Send a StoredQuery ServiceClient sender = getRegistryServiceClient(); OMElement response = sender.sendReceive( request ); assertNotNull(response); //4. Verify the response is correct OMAttribute status = response.getAttribute(new QName("status")); assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); //5. Verify that the given patientId is found from the StoredQuery response. NodeList nodes = getPatientIdNodes(response, patientId, "findDocuments"); assertTrue(nodes.getLength() == 1); String result = response.toString(); System.out.println("Result:\n" +result); }
Example #19
Source File: MTOMSwAClient.java From micro-integrator with Apache License 2.0 | 5 votes |
private static ServiceClient createServiceClient() throws AxisFault { String repo = getProperty("repository", "client_repo"); if (repo != null && !"null".equals(repo)) { ConfigurationContext configContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem(repo, repo + File.separator + "conf" + File.separator + "axis2.xml"); return new ServiceClient(configContext, null); } else { return new ServiceClient(); } }
Example #20
Source File: CrossGatewayQueryTest.java From openxds with Apache License 2.0 | 5 votes |
/** * This test issues a FindDocuments Cross Gateway Query (XGQ) * to the XDS Registry's Receiving Gateway requesting ObjectRefs (document references) be returned. * @throws Exception */ @Test public void testFindDocsObjectRef() throws Exception { //1. Submit a document first for a random patientId String patientId = generateAPatientId(); String uuids = submitMultipleDocuments(patientId); //2. Generate StoredQuery request message String message = findDocumentsQuery(patientId, "Approved", "ObjectRef"); OMElement request = OMUtil.xmlStringToOM(message); System.out.println("Request:\n" +request); //3. Send a StoredQuery ServiceClient sender = getRegistryGateWayClient(); OMElement response = sender.sendReceive( request ); assertNotNull(response); //4. Verify the response is correct OMAttribute status = response.getAttribute(new QName("status")); assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); //5. Verify that the 2 ObjectRefs found from the StoredQuery response. NodeList count = getNodeCount(response, "ObjectRef"); assertTrue(count.getLength() == 2); String result = response.toString(); System.out.println("Result:\n" +result); }
Example #21
Source File: EntitlementServiceClient.java From carbon-identity with Apache License 2.0 | 5 votes |
/** * 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 #22
Source File: SCIMConfigAdminClient.java From carbon-identity with Apache License 2.0 | 5 votes |
/** * 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 #23
Source File: WSXACMLEntitlementServiceClient.java From carbon-identity with Apache License 2.0 | 5 votes |
/** * Get decision in a secured manner using the * SAML implementation of XACML using X.509 credentials * * @return decision extracted from the SAMLResponse sent from PDP * @throws Exception */ @Override public String getDecision(Attribute[] attributes, String appId) throws Exception { String xacmlRequest; String xacmlAuthzDecisionQuery; OMElement samlResponseElement; String samlResponse; String result; try { xacmlRequest = XACMLRequetBuilder.buildXACML3Request(attributes); xacmlAuthzDecisionQuery = buildSAMLXACMLAuthzDecisionQuery(xacmlRequest); ServiceClient sc = new ServiceClient(); Options opts = new Options(); opts.setTo(new EndpointReference(serverUrl + "ws-xacml")); opts.setAction("XACMLAuthzDecisionQuery"); opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, authenticator); opts.setManageSession(true); sc.setOptions(opts); samlResponseElement = sc.sendReceive(AXIOMUtil.stringToOM(xacmlAuthzDecisionQuery)); samlResponse = samlResponseElement.toString(); result = extractXACMLResponse(samlResponse); sc.cleanupTransport(); return result; } catch (Exception e) { log.error("Error occurred while getting decision using SAML.", e); throw new Exception("Error occurred while getting decision using SAML.", e); } }
Example #24
Source File: TcpClient.java From product-ei with Apache License 2.0 | 5 votes |
public TcpClient() { String repositoryPath = /*ProductConstant.getModuleClientPath()*/FrameworkPathUtil.getSystemResourceLocation()+File.separator+"client"; File repository = new File(repositoryPath); try { cfgCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository.getCanonicalPath(), /*ProductConstant.getResourceLocations(ProductConstant.ESB_SERVER_NAME)*/FrameworkPathUtil.getSystemResourceLocation()+File.separator + "artifacts"+File.separator + "ESB" + File.separator + "tcp" + File.separator + "transport" + File.separator + "client_axis2.xml"); serviceClient = new ServiceClient(cfgCtx, null); } catch (Exception e) { log.error(e); } }
Example #25
Source File: EventBrokerAdminClient.java From product-ei with Apache License 2.0 | 5 votes |
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 #26
Source File: ApplicationCreationWSWorkflowExecutorTest.java From carbon-apimgt with Apache License 2.0 | 5 votes |
@Before public void init() { applicationCreationWSWorkflowExecutor = new ApplicationCreationWSWorkflowExecutor(); applicationCreationWSWorkflowExecutor.setPassword("admin".toCharArray()); applicationCreationWSWorkflowExecutor.setUsername("admin"); applicationCreationWSWorkflowExecutor.setServiceEndpoint("http://localhost:9445/service"); applicationCreationWSWorkflowExecutor.setCallbackURL("http://localhost:8243/workflow-callback"); PowerMockito.mockStatic(ApiMgtDAO.class); apiMgtDAO = Mockito.mock(ApiMgtDAO.class); serviceClient = Mockito.mock(ServiceClient.class); PowerMockito.when(ApiMgtDAO.getInstance()).thenReturn(apiMgtDAO); }
Example #27
Source File: AxisServiceClientUtils.java From product-ei with Apache License 2.0 | 5 votes |
public static OMElement sendRequest(String payloadStr, EndpointReference targetEPR) throws XMLStreamException, AxisFault { OMElement payload = AXIOMUtil.stringToOM(payloadStr); Options options = new Options(); options.setTo(targetEPR); //options.setAction("urn:" + operation); //since soapAction = "" //Blocking invocation ServiceClient sender = new ServiceClient(); sender.setOptions(options); OMElement result = sender.sendReceive(payload); //log.info(result.toString()); return result; }
Example #28
Source File: SAMLSSOValidatorServiceClient.java From carbon-identity with Apache License 2.0 | 5 votes |
public SAMLSSOValidatorServiceClient(String cookie, String backendServerURL, ConfigurationContext configCtx) throws AxisFault { try { String serviceURL = backendServerURL + "IdentitySAMLValidatorService"; stub = new IdentitySAMLValidatorServiceStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault ex) { log.error("Error generating stub for IdentitySAMLValidatorService", ex); throw new AxisFault("Error generating stub for IdentitySAMLValidatorService", ex); } }
Example #29
Source File: Sample705TestCase.java From micro-integrator with Apache License 2.0 | 5 votes |
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE }) @Test(groups = { "wso2.esb" }, description = "Test forwarding with load balancing") public void loadBalancingTest() throws Exception { ServiceClient serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(getProxyServiceURLHttp("Sample705StockQuoteProxy"))); options.setAction("urn:placeOrder"); serviceClient.setOptions(options); for (int i = 0; i < 100; i++) { serviceClient.sendRobust(createPayload()); } }
Example #30
Source File: UserManagementWorkflowServiceClient.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * @param cookie * @param backendServerURL * @param configCtx * @throws org.apache.axis2.AxisFault */ public UserManagementWorkflowServiceClient(String cookie, String backendServerURL, ConfigurationContext configCtx) throws AxisFault { String serviceURL = backendServerURL + "UserManagementWorkflowService"; stub = new UserManagementWorkflowServiceStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }