Package com.ibm.sbt.services.client

Examples of com.ibm.sbt.services.client.Response


   */
  public Profile getMyProfile() throws ProfileServiceException {
    JsonObject result = null;
    try {
      //making a call directly here using ClientService's get method, 
      Response response = endpoint.getClientService().get(ProfileConstants.GETUSERIDENTITY.getUrl(), ClientService.FORMAT_JSON);
      result = (JsonObject) response.getData() ;
    } catch (ClientServicesException cse) {
      throw new ProfileServiceException(cse, Messages.InvalidValue_1);
    }
    String userId = (String) result.getJsonProperty("subscriberid");
    if (StringUtil.isEmpty(userId)) {
View Full Code Here


     * @throws BssException
     */
    public EntityList<JsonEntity> createSubscription(JsonJavaObject orderObject) throws BssException {
    try {
      String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION.format(this);
      Response serverResponse = createData(serviceUrl, null, JsonHeader, orderObject, ClientService.FORMAT_JSON);
     
      IFeedHandler<JsonEntity> jsonHandler = getJsonFeedHandler();
      return jsonHandler.createEntityList(serverResponse);
    } catch (Exception e) {
      throw new BssException(e, "Error creating subscription {0} caused by {1}", orderObject, e.getMessage());
View Full Code Here

     * @throws BssException
     */
    public void suspendSubscription(String subscriptionId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SUBSCRIPTIONID.format(this, new NamedUrlPart("subscriptionId", subscriptionId));
        Response response = createData(serviceUrl, null, SuspendSubscriptionHeader, (Object)null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error suspending subscription {0} caused by {1}", subscriptionId, statusCode);
        }
    } catch (Exception e) {
      throw new BssException(e, "Error suspending subscription {0} caused by {1}", subscriptionId, e.getMessage());     
View Full Code Here

     * @throws BssException
     */
    public void unsuspendSubscription(String subscriptionId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SUBSCRIPTIONID.format(this, new NamedUrlPart("subscriptionId", subscriptionId));
        Response response = createData(serviceUrl, (Map<String, String>)null, UnsuspendSubscriptionHeader, (Object)null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error unsuspending subscription {0} caused by {1}", subscriptionId, statusCode);
        }
    } catch (Exception e) {
      throw new BssException(e, "Error unsuspending subscription {0} caused by {1}", subscriptionId, e.getMessage());     
View Full Code Here

     * @throws BssException
     */
    public void cancelSubscription(String subscriptionId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SUBSCRIPTIONID.format(this, new NamedUrlPart("subscriptionId", subscriptionId));
        Response response = deleteData(serviceUrl, null, null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error cancelling subscription {0} caused by {1}", subscriptionId, statusCode);
        }
    } catch (Exception e) {
      throw new BssException(e, "Error cancelling subscription {0} caused by {1]", subscriptionId, e.getMessage());     
View Full Code Here

     */
    public void updateSubscription(JsonJavaObject subscriptionObject) throws BssException {
      try {
        String subscriptionId = getSubscriptionId(subscriptionObject);
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SUBSCRIPTIONID.format(this, new NamedUrlPart("subscriptionId", subscriptionId));
        Response response = updateData(serviceUrl, null, JsonHeader, subscriptionObject, null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error updating subscription {0} causd by {1}", subscriptionObject, statusCode);
        }
    } catch (Exception e) {
      throw new BssException(e, "Error updating subscription {0} caused by {1}", subscriptionObject, e.getMessage());     
View Full Code Here

     */
    public void updateCustomerProfile(JsonJavaObject customerObject) throws BssException {
      try {
        String customerId = getCustomerId(customerObject);
        String serviceUrl = BssUrls.API_RESOURCE_CUSTOMER_CUSTOMERID.format(this, BssUrls.customerId(customerId));
        Response response = updateData(serviceUrl, null, JsonHeader, customerObject, null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error updating customer profile {0}", customerObject);
        }
    } catch (Exception e) {
      throw new BssException(e, "Error updating customer profile {0} caused by {1}", customerObject, e.getMessage());     
View Full Code Here

   * @throws ProfileServiceException
   */
  public void deleteProfile(String id) throws ClientServicesException
 
    String deleteUrl = ProfileUrls.ADMIN_PROFILE_ENTRY.format(this, ProfileParams.userId.get(id));
    Response response = deleteData(deleteUrl, null, ProfileParams.userId.getParamName(id));
    checkResponseCode(response, HTTPCode.OK);
  }
View Full Code Here

     * @throws BssException
     */
    public void unregisterCustomer(String customerId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_CUSTOMER_CUSTOMERID.format(this, BssUrls.customerId(customerId));
        Response response = deleteData(serviceUrl, null, null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error unregistering customer {0}", customerId);
        }
    } catch (Exception e) {
      throw new BssException(e, "Error unregistering customer {0} caused by {1}", customerId, e.getMessage());     
View Full Code Here

    String id = profile.getUserid();
    parameters.put(ProfileParams.userId.getParamName(id), id);
    Object createPayload = constructCreateRequestBody(profile);
   
    String createUrl = ProfileUrls.ADMIN_PROFILES.format(this);
    Response response = createData(createUrl, parameters, createPayload, ClientService.FORMAT_CONNECTIONS_OUTPUT);
    checkResponseCode(response, HTTPCode.OK);
  }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.client.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.