/**
   * 1. Check validity of execution plan 2. If execution plan exist with same name edit it 3. Else
   * deploy new execution plan
   *
   * @param name Name of execution plan
   * @param executionPlan execution query plan
   * @param sessionCookie session cookie to use established connection
   * @throws RemoteException
   */
  private void deploy(String name, String executionPlan, String sessionCookie)
      throws RemoteException {
    ServiceClient serviceClient;
    Options options;

    EventProcessorAdminServiceStub eventProcessorAdminServiceStub =
        new EventProcessorAdminServiceStub(
            policyDeployerConfiguration.getServiceUrl() + "EventProcessorAdminService");
    serviceClient = eventProcessorAdminServiceStub._getServiceClient();
    options = serviceClient.getOptions();
    options.setManageSession(true);
    options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);

    eventProcessorAdminServiceStub.validateExecutionPlan(executionPlan);
    ExecutionPlanConfigurationDto[] executionPlanConfigurationDtos =
        eventProcessorAdminServiceStub.getAllActiveExecutionPlanConfigurations();
    boolean isUpdateRequest = false;
    if (executionPlanConfigurationDtos != null) {
      for (ExecutionPlanConfigurationDto executionPlanConfigurationDto :
          executionPlanConfigurationDtos) {
        if (executionPlanConfigurationDto.getName().trim().equals(name)) {
          eventProcessorAdminServiceStub.editActiveExecutionPlan(executionPlan, name);
          isUpdateRequest = true;
          break;
        }
      }
    }
    if (!isUpdateRequest) {
      eventProcessorAdminServiceStub.deployExecutionPlan(executionPlan);
    }
  }
  /**
   * Retrieve all entries from service.
   *
   * @return All entries of type Entry from the service.
   * @exception FailureFaultException If an error communication with the service occurs.
   */
  public Entry[] retrieve() throws FailureFaultException {
    final String method = "retrieve";
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMNamespace namespace = factory.createOMNamespace(SERVICE, method);

    // Create a request
    OMElement request = factory.createOMElement("RetrieveRequest", namespace);

    // Configure connection
    Options options = new Options();
    options.setTo(new EndpointReference(url.toString()));
    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    options.setAction(method);

    // Create a client
    try {
      ServiceClient client = new ServiceClient();
      client.setOptions(options);

      // Try send request and receive response, could throw AxisFault
      OMElement response = client.sendReceive(request);

      // Debug
      printDebug("RESPONSE", response);

      // Parse and return result
      Entry[] result = XMLUtil.parseScores(response);
      return result;
    } catch (AxisFault e) {
      throw new FailureFaultException("Exception from service: ", e);
    }
  }
  /**
   * Checks the validity of a execution plan
   *
   * @param executionPlan
   * @return boolean
   */
  public boolean validateExecutionPlan(String executionPlan) {

    ServiceClient serviceClient;
    Options options;
    String result = null;
    try {
      String sessionCookie = login();
      EventProcessorAdminServiceStub eventProcessorAdminServiceStub =
          new EventProcessorAdminServiceStub(
              policyDeployerConfiguration.getServiceUrl() + "EventProcessorAdminService");

      serviceClient = eventProcessorAdminServiceStub._getServiceClient();
      options = serviceClient.getOptions();
      options.setManageSession(true);
      options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);

      result = eventProcessorAdminServiceStub.validateExecutionPlan(executionPlan);

    } catch (RemoteException e) {
      return false;
    } catch (MalformedURLException e) {
      return false;
    } catch (LoginAuthenticationExceptionException e) {
      return false;
    }

    if ("success".equalsIgnoreCase(result)) {
      return true;
    }
    return false;
  }
Пример #4
0
  private static boolean JARServiceTest() {
    boolean JARServiceStatus = false;
    OMElement result;
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2", "ns1");
    OMElement payload = fac.createOMElement("echo", omNs);
    OMElement value = fac.createOMElement("args0", omNs);
    value.addChild(fac.createOMText(value, "Hello-World"));
    payload.addChild(value);

    ServiceClient serviceclient;
    try {
      serviceclient = new ServiceClient();
      Options opts = new Options();

      opts.setTo(new EndpointReference(HTTP_APPSERVER_STRATOSLIVE_URL + "/SimpleJarService"));
      opts.setAction("echo");
      // bypass http protocol exception
      opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);

      serviceclient.setOptions(opts);

      result = serviceclient.sendReceive(payload);

      if ((result.toString().indexOf("Hello-World")) > 0) {
        JARServiceStatus = true;
      }
      assertTrue("Jar service invocation failed", JARServiceStatus);

    } catch (AxisFault axisFault) {
      log.error("Jar service invocation failed:" + axisFault.getMessage());
      fail("Jar service invocation failed:" + axisFault.getMessage());
    }
    return JARServiceStatus;
  }
  @edu.umd.cs.findbugs.annotations.SuppressWarnings(
      value = "PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS",
      justification = "It is required to set two options on the Options object")
  public APIKeyValidatorClient() throws APISecurityException {
    APIManagerConfiguration config =
        ServiceReferenceHolder.getInstance().getAPIManagerConfiguration();
    String serviceURL = config.getFirstProperty(APIConstants.API_KEY_VALIDATOR_URL);
    username = config.getFirstProperty(APIConstants.API_KEY_VALIDATOR_USERNAME);
    password = config.getFirstProperty(APIConstants.API_KEY_VALIDATOR_PASSWORD);
    if (serviceURL == null || username == null || password == null) {
      throw new APISecurityException(
          APISecurityConstants.API_AUTH_GENERAL_ERROR,
          "Required connection details for the key management server not provided");
    }

    try {
      ConfigurationContext ctx =
          ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
      keyValidationServiceStub =
          new APIKeyValidationServiceStub(ctx, serviceURL + "APIKeyValidationService");
      ServiceClient client = keyValidationServiceStub._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.setCallTransportCleanup(true);
      options.setManageSession(true);

    } catch (AxisFault axisFault) {
      throw new APISecurityException(
          APISecurityConstants.API_AUTH_GENERAL_ERROR,
          "Error while initializing the API key validation stub",
          axisFault);
    }
  }
  /**
   * Login to the API gateway as an admin
   *
   * @return A session cookie string
   * @throws AxisFault if an error occurs while logging in
   */
  private String login(Environment environment) throws AxisFault {
    String user = environment.getUserName();
    String password = environment.getPassword();
    String serverURL = environment.getServerURL();

    if (serverURL == null || user == null || password == null) {
      throw new AxisFault("Required API gateway admin configuration unspecified");
    }

    String host;
    try {
      host = new URL(serverURL).getHost();
    } catch (MalformedURLException e) {
      throw new AxisFault("API gateway URL is malformed", e);
    }

    AuthenticationAdminStub authAdminStub =
        new AuthenticationAdminStub(null, serverURL + "AuthenticationAdmin");
    ServiceClient client = authAdminStub._getServiceClient();
    Options options = client.getOptions();
    options.setManageSession(true);
    try {
      authAdminStub.login(user, password, host);
      ServiceContext serviceContext =
          authAdminStub._getServiceClient().getLastOperationContext().getServiceContext();
      return (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
    } catch (RemoteException e) {
      throw new AxisFault("Error while contacting the authentication admin services", e);
    } catch (LoginAuthenticationExceptionException e) {
      throw new AxisFault("Error while authenticating against the API gateway admin", e);
    }
  }
  public ManageGenericArtifactServiceClient(ServletConfig config, HttpSession session)
      throws RegistryException {

    String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
    String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
    ConfigurationContext configContext =
        (ConfigurationContext)
            config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
    epr = backendServerURL + "ManageGenericArtifactService";

    try {
      stub = new ManageGenericArtifactServiceStub(configContext, epr);

      ServiceClient client = stub._getServiceClient();
      Options option = client.getOptions();
      option.setManageSession(true);
      option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);

    } catch (AxisFault axisFault) {
      String msg =
          "Failed to initiate ManageGenericArtifactServiceClient. " + axisFault.getMessage();
      log.error(msg, axisFault);
      throw new RegistryException(msg, axisFault);
    }
  }
  public static OMElement sendReceive(
      OMElement payload, String endPointReference, String operation, String contentType)
      throws AxisFault {

    ServiceClient sender;
    Options options;
    OMElement response = null;
    if (log.isDebugEnabled()) {
      log.debug("Service Endpoint : " + endPointReference);
      log.debug("Service Operation : " + operation);
      log.debug("Payload : " + payload);
    }
    try {
      sender = new ServiceClient();
      options = new Options();
      options.setTo(new EndpointReference(endPointReference));
      options.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
      options.setTimeOutInMilliSeconds(45000);
      options.setAction("urn:" + operation);
      options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
      options.setProperty(Constants.Configuration.MESSAGE_TYPE, contentType);
      sender.setOptions(options);

      response = sender.sendReceive(payload);
      if (log.isDebugEnabled()) {
        log.debug("Response Message : " + response);
      }
    } catch (AxisFault axisFault) {
      log.error(axisFault.getMessage());
      throw new AxisFault("AxisFault while getting response :" + axisFault.getMessage(), axisFault);
    }
    return response;
  }
  public static void UserAdmin() {
    try {
      String serviceName = "UserAdmin";
      UserAdminStub statisticsAdminStub;
      String backEndUrl = "https://localhost:9443/services/";
      String endPoint = backEndUrl + "/services/" + serviceName;
      statisticsAdminStub = new UserAdminStub(endPoint);
      // Authenticate Your stub from sessionCooke
      ServiceClient serviceClient;
      Options option;

      serviceClient = statisticsAdminStub._getServiceClient();
      option = serviceClient.getOptions();
      option.setManageSession(true);
      option.setProperty(
          org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);

      UserRealmInfo stat = statisticsAdminStub.getUserRealmInfo();
      System.out.println(stat.getAdminRole());
      System.out.println(stat.getAdminUser());
      System.out.println(stat.getEveryOneRole());

    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
  }
Пример #10
0
  public SubscriberKeyMgtClient(String backendServerURL, String username, String password)
      throws Exception {
    try {
      AuthenticationAdminStub authenticationAdminStub =
          new AuthenticationAdminStub(null, backendServerURL + "AuthenticationAdmin");
      ServiceClient authAdminServiceClient = authenticationAdminStub._getServiceClient();
      authAdminServiceClient.getOptions().setManageSession(true);
      authenticationAdminStub.login(username, password, new URL(backendServerURL).getHost());
      ServiceContext serviceContext =
          authenticationAdminStub._getServiceClient().getLastOperationContext().getServiceContext();
      String authenticatedCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);

      if (log.isDebugEnabled()) {
        log.debug(
            "Authentication Successful with AuthenticationAdmin. "
                + "Authenticated Cookie ID : "
                + authenticatedCookie);
      }

      subscriberServiceStub =
          new APIKeyMgtSubscriberServiceStub(null, backendServerURL + "APIKeyMgtSubscriberService");
      ServiceClient client = subscriberServiceStub._getServiceClient();
      Options options = client.getOptions();
      options.setManageSession(true);
      options.setProperty(
          org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, authenticatedCookie);
    } catch (Exception e) {
      String errorMsg = "Error when instantiating SubscriberKeyMgtClient.";
      log.error(errorMsg, e);
      throw e;
    }
  }
Пример #11
0
  public static void main(String[] args) throws Exception {
    WebappAdminStub stub = null;
    try {
      String cookie = authenticate(username, password);
      if (cookie == null) {
        System.err.println("Error authenticating user : "******"WebappAdmin");
      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);

      // build webapp data
      WebappUploadData data = getUploadData(inputStream, webappName, webappVersion);
      // upload the war file
      stub.uploadWebapp(new WebappUploadData[] {data});
      System.out.println("Successfully uploaded the webapp");
    } finally {
      if (stub != null) {
        try {
          stub.cleanup();
        } catch (Exception ignore) {

        }
      }
    }
  }
  public static void ServiceAdmin() {
    try {
      String serviceName = "ServiceAdmin";
      ServiceAdminStub stub;
      String backEndUrl = "https://localhost:9443/services";
      String endPoint = backEndUrl + "/services/" + serviceName;
      stub = new ServiceAdminStub(endPoint);
      // Authenticate Your stub from sessionCooke
      ServiceClient serviceClient;
      Options option;

      serviceClient = stub._getServiceClient();
      option = serviceClient.getOptions();
      option.setManageSession(true);
      option.setProperty(
          org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);

      System.out.println(stub.getNumberOfActiveServices());
      // System.out.println(stub.isUserValid("admin", "user"));

    } catch (Exception e) {
      System.out.println(e.getMessage());
    }

    //		ServiceAdminLibrary li = new ServiceAdminLibrary();
    //		try {
    //			li.initServiceAdmin();
    //			System.out.println(li.getNumberOfActiveServices());
    //			li.AssertgetNumberOfActiveServices(4);
    //		} catch (Exception e) {
    //			System.out.println(e.getMessage());
    //		}

  }
  public void sendUsingMTOM(String fileName, String targetEPR) throws IOException {
    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("urn:uploadFileUsingMTOM");
    options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
    options.setCallTransportCleanup(true);
    serviceClient.setOptions(options);
    OMElement response = serviceClient.sendReceive(payload);
    Assert.assertTrue(
        response
            .toString()
            .contains(
                "<m:testMTOM xmlns:m=\"http://services.samples/xsd\">"
                    + "<m:test1>testMTOM</m:test1></m:testMTOM>"));
  }
  public static void StatisticsAdmin() {
    try {
      String serviceName = "StatisticsAdmin";
      StatisticsAdminStub statisticsAdminStub;
      String backEndUrl = "https://localhost:9443/services/";
      String endPoint = backEndUrl + "/services/" + serviceName;
      statisticsAdminStub = new StatisticsAdminStub(endPoint);
      // Authenticate Your stub from sessionCooke
      ServiceClient serviceClient;
      Options option;

      serviceClient = statisticsAdminStub._getServiceClient();
      option = serviceClient.getOptions();
      option.setManageSession(true);
      option.setProperty(
          org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);

      SystemStatistics stat = statisticsAdminStub.getSystemStatistics();
      System.out.println("Host :" + stat.getServerName());
      System.out.println("Server Start Time :" + stat.getServerStartTime());
      System.out.println("System Up Time :" + stat.getSystemUpTime());
      System.out.print(stat.getUsedMemory().getValue() + stat.getUsedMemory().getUnit() + " of ");
      System.out.println(
          stat.getTotalMemory().getValue() + stat.getTotalMemory().getUnit() + " memory used");

    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
  }
  @Override
  public String getDecision(String userName, String resource, String action, String[] env)
      throws Exception {

    String decision;
    // authenticate for every request. we need to decide this TODO
    if (authenticate()) {
      try {
        String serviceURL = backEndServerURL + "EntitlementService";
        EntitlementServiceStub stub = new EntitlementServiceStub(configCtx, serviceURL);
        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
        option.setProperty(HTTPConstants.COOKIE_STRING, authCookie);
        decision = getStatus(stub.getDecisionByAttributes(userName, resource, action, env));
        stub.cleanup();
      } catch (Exception e) {
        log.error("Error occurred while policy evaluation", e);
        throw e;
      }

    } else {
      log.error("User can not be authenticated to evaluate the entitlement query");
      throw new Exception("User can not be authenticated to evaluate the entitlement query");
    }
    return decision;
  }
Пример #16
0
  private static boolean axis2ServiceTest() {
    boolean axis2ServiceStatus = false;

    OMElement result;
    try {
      OMElement payload = createPayLoad();
      ServiceClient serviceclient = new ServiceClient();
      Options opts = new Options();

      opts.setTo(new EndpointReference(HTTP_APPSERVER_STRATOSLIVE_URL + "/Axis2Service"));
      opts.setAction("http://service.carbon.wso2.org/echoString");
      opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
      serviceclient.setOptions(opts);

      result = serviceclient.sendReceive(payload);

      if ((result.toString().indexOf("Hello World")) > 0) {
        axis2ServiceStatus = true;
      }
      assertTrue("Axis2Service invocation failed", axis2ServiceStatus);

    } catch (AxisFault axisFault) {
      log.error("Axis2Service invocation failed :" + axisFault.getMessage());
      fail("Axis2Service invocation failed :" + axisFault.getMessage());
    }

    return axis2ServiceStatus;
  }
  public APIKeyValidatorClient() throws APISecurityException {
    APIManagerConfiguration config =
        ServiceReferenceHolder.getInstance().getAPIManagerConfiguration();
    String serviceURL = config.getFirstProperty(APIConstants.API_KEY_MANAGER_URL);
    username = config.getFirstProperty(APIConstants.API_KEY_MANAGER_USERNAME);
    password = config.getFirstProperty(APIConstants.API_KEY_MANAGER_PASSWORD);
    if (serviceURL == null || username == null || password == null) {
      throw new APISecurityException(
          APISecurityConstants.API_AUTH_GENERAL_ERROR,
          "Required connection details for the key management server not provided");
    }

    try {
      clientStub = new APIKeyValidationServiceStub(null, serviceURL + "APIKeyValidationService");
      ServiceClient client = clientStub._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.setCallTransportCleanup(true);
      options.setManageSession(true);
    } catch (AxisFault axisFault) {
      throw new APISecurityException(
          APISecurityConstants.API_AUTH_GENERAL_ERROR,
          "Error while initializing the API key validation stub",
          axisFault);
    }
  }
Пример #18
0
  private ServiceClient getRESTEnabledServiceClient(String trpUrl, String addUrl, String operation)
      throws AxisFault {
    ServiceClient serviceClient = getServiceClient(trpUrl, addUrl, operation);
    serviceClient.getOptions().setProperty("enableREST", "true");

    return serviceClient;
  }
Пример #19
0
  private ServiceClient getServiceClient(String trpUrl, String addUrl, String operation)
      throws AxisFault {

    ServiceClient serviceClient;
    Options options = new Options();

    if (addUrl != null && !"null".equals(addUrl)) {
      serviceClient =
          new ServiceClient(
              ConfigurationContextProvider.getInstance().getConfigurationContext(), null);
      serviceClient.engageModule("addressing");
      options.setTo(new EndpointReference(addUrl));
    } else {
      // otherwise it will engage addressing all the time once addressing is engaged by
      // ConfigurationContext to service client
      serviceClient = new ServiceClient();
    }

    if (trpUrl != null && !"null".equals(trpUrl)) {
      options.setProperty(Constants.Configuration.TRANSPORT_URL, trpUrl);
    }

    options.setAction("urn:" + operation);
    if (httpHeaders.size() > 0) {
      options.setProperty(HTTPConstants.HTTP_HEADERS, httpHeaders);
    }
    options.setTimeOutInMilliSeconds(45000);
    /*  options.setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
    options.setProperty(Constants.Configuration.MESSAGE_TYPE,HTTPConstants.MEDIA_TYPE_APPLICATION_ECHO_XML);
    options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE);*/
    serviceClient.setOptions(options);

    return serviceClient;
  }
Пример #20
0
  public static String sendSOAP(
      EndpointReference soapEPR, String requestString, String action, String operation)
      throws Exception {

    ServiceClient sender = PmServiceClient.getServiceClient();
    OperationClient operationClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

    // creating message context
    MessageContext outMsgCtx = new MessageContext();
    // assigning message context's option object into instance variable
    Options opts = outMsgCtx.getOptions();
    // setting properties into option
    log.debug(soapEPR);
    opts.setTo(soapEPR);
    opts.setAction(action);
    opts.setTimeOutInMilliSeconds(180000);

    log.debug(requestString);

    SOAPEnvelope envelope = null;

    try {
      SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
      envelope = fac.getDefaultEnvelope();
      OMNamespace omNs =
          fac.createOMNamespace(
              "http://rpdr.partners.org/", //$NON-NLS-1$
              "rpdr"); //$NON-NLS-1$

      // creating the SOAP payload
      OMElement method = fac.createOMElement(operation, omNs);
      OMElement value = fac.createOMElement("RequestXmlString", omNs); // $NON-NLS-1$
      value.setText(requestString);
      method.addChild(value);
      envelope.getBody().addChild(method);
    } catch (FactoryConfigurationError e) {
      log.error(e.getMessage());
      throw new Exception(e);
    }

    outMsgCtx.setEnvelope(envelope);

    operationClient.addMessageContext(outMsgCtx);
    operationClient.execute(true);

    MessageContext inMsgtCtx = operationClient.getMessageContext("In"); // $NON-NLS-1$
    SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope();

    OMElement soapResponse = responseEnv.getBody().getFirstElement();
    //		System.out.println("Sresponse: "+ soapResponse.toString());
    OMElement soapResult = soapResponse.getFirstElement();
    //		System.out.println("Sresult: "+ soapResult.toString());

    String i2b2Response = soapResult.getText();
    log.debug(i2b2Response);

    return i2b2Response;
  }
 public MediationStatisticsClient(
     ConfigurationContext configCtx, String backendServerURL, String cookie) throws AxisFault {
   String serviceURL = backendServerURL + "MediationStatisticsAdmin";
   stub = new MediationStatisticsAdminStub(configCtx, serviceURL);
   ServiceClient client = stub._getServiceClient();
   Options options = client.getOptions();
   options.setManageSession(true);
   options.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
 }
 public IdentityProviderClient(
     String cookie, String backendServerURL, ConfigurationContext configCtx) throws AxisFault {
   String serviceURL = backendServerURL + "IdentityProviderAdminService";
   stub = new IdentityProviderAdminServiceStub(configCtx, serviceURL);
   ServiceClient client = stub._getServiceClient();
   Options option = client.getOptions();
   option.setManageSession(true);
   option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
 }
Пример #23
0
 public OMElement sendSimpleStockQuoteRequestREST(String trpUrl, String addUrl, String symbol)
     throws AxisFault {
   ServiceClient sc = getRESTEnabledServiceClient(trpUrl, addUrl);
   try {
     return buildResponse(sc.sendReceive(createStandardRequest(symbol)));
   } finally {
     sc.cleanupTransport();
   }
 }
 public BAMToolBoxDeployerClient(
     String cookie, String backEndServerURL, ConfigurationContext configCtx) throws AxisFault {
   String serviceURL = backEndServerURL + BAMToolBoxService;
   stub = new BAMToolboxDepolyerServiceStub(configCtx, serviceURL);
   ServiceClient client = stub._getServiceClient();
   Options option = client.getOptions();
   option.setManageSession(true);
   option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
 }
Пример #25
0
  public OMElement sendSimpleStockQuoteRequestREST(String trpUrl, String addUrl, OMElement payload)
      throws AxisFault {

    ServiceClient serviceClient = getRESTEnabledServiceClient(trpUrl, addUrl);
    try {
      return buildResponse(serviceClient.sendReceive(payload));
    } finally {
      serviceClient.cleanupTransport();
    }
  }
 /**
  * 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);
 }
Пример #27
0
  public OMElement send(String trpUrl, String addUrl, String action, OMElement payload)
      throws AxisFault {

    ServiceClient serviceClient = getServiceClient(trpUrl, addUrl, action);
    try {
      return buildResponse(serviceClient.sendReceive(payload));
    } finally {
      serviceClient.cleanupTransport();
    }
  }
Пример #28
0
  public OMElement sendMultipleQuoteRequestREST(String trpUrl, String addUrl, String symbol, int n)
      throws AxisFault {

    ServiceClient serviceClient = getRESTEnabledServiceClient(trpUrl, addUrl);
    try {
      return buildResponse(serviceClient.sendReceive(createMultipleQuoteRequest(symbol, n)));
    } finally {
      serviceClient.cleanupTransport();
    }
  }
  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);
  }
Пример #30
0
  public OMElement sendCustomQuoteRequest(String trpUrl, String addUrl, String symbol)
      throws AxisFault {

    ServiceClient serviceClient = getServiceClient(trpUrl, addUrl);
    try {
      return buildResponse(serviceClient.sendReceive(createCustomQuoteRequest(symbol)));
    } finally {
      serviceClient.cleanupTransport();
    }
  }