Configure Oracle Sales and Service Application Integration

In this section, you will add the Oracle Sales and Service application common functionality needed to communicate with OCM. This entails creating new web services to communicate with the OCM document REST APIs, Oracle Sales and Service application global functions to call these new web services, and an Oracle Sales and Service application mashup to expose this OCM Embedded UI integration.

Create a Sandbox

To create a sandbox to implement the Oracle Sales and Service Application changes for this integration:

  1. Sign in as the Oracle Sales and Service administrator.
  2. Click Hamburger icon in the upper left corner of the page. Select the Configuration option from the menu and then select Sandboxes.

  3. On the Create Sandbox page, complete the following fields:

    1. On the Sandboxes page, click Create Sandbox.
    2. On the Create Sandbox page, specify a name for this sandbox in the Name field (for example, OCM Document Collaboration Integration).
    3. From the All Tools list, select the Application Composer check box.
    4. Click Create and Enter.
  4. To enter the application composer where you will be making your OCM integration changes, click Tools in the upper left corner of the page and then select Application Composer from the drop-down list.

Create Web Services

Web Services are used to communicate with OCM through the OCM document REST APIs.

OCMCreateFolderService

To create the OCM create folder web service:
  1. Choose Common Setup and then Web Services from the left navigation menu.
  2. On the Web Services page, click the Create a new Web Service icon.
  3. In the Select Connection Type dialog, select the REST option and click OK.
  4. On the Create REST Web Services Connection page, complete the following fields:

    1. In the Name field, specify the name of the folder as OCMCreateFolderService.
    2. In the URL field, enter the web service URL as https://<OCMServerURL>/documents/api/1.2/folders/##OCMParentFolderId##?name=##OCMFolderName## that is needed to create the OCM folder. Where <OCMServerURL> is the Oracle Content Management server that is used for this integration (for example, https://mycloud.com/documents/api/1.2/folders/##OCMParentFolderId##?name=##OCMFolderName##).
    3. In the Authentication Scheme section, select the None option as it will be configured in the next step.
    4. In the Select and Configure Methods against Resource section, select the POST check box.
    5. In the Response Payload section, select the Code Sample option and add {} to the multi-line text box.
  5. To create the IDCS OAUTH authentication scheme that will be used for the web services, on the Create REST Web Services Connection page, complete the following fields:

    Note:

    These steps are only required when you are creating a web service to OCM for the first time.


    1. In the Authentication Scheme section, select the Call using IDCS OAUTH option.
    2. In the Token URI field, enter the IDCS server URL https://<idcsServerURL>/oauth2/v1/token. Where <idcsServerURL> is the URL to the IDCS server that is used for this integration.
    3. In the Scope field, enter the scope that was copied above when creating the IDCS OAUTH authentication scheme (for example, https://BD2F184D9D2344CB8134FCD4CBFF7DF.mycloud.com:443/urn:opc:cec:all).
    4. To create the client credential key, complete the following fields:
      1. Select the Create Credential Key icon next to the Client Credential Key field.
      2. In the CSF Key field, enter the key (for example, Web Services).
      3. In the User Name field, enter the client ID that was copied above when creating the IDCS OAUTH authentication scheme (for example, c585b2d3e97c40e491ca99112281e36).
      4. In the Password field, enter the client secret that was copied above when creating the IDCS OAUTH authentication scheme (for example, 768b9513-658e-4854-bac7-2fe72d19011).
      5. Click OK.
    5. To create the OCM credential key for switch identity, complete the following fields:
      1. Select the Create Credential Key icon next to the Credential Key for Credential Key field.
      2. In the CSF Key field, enter the key (for example, OCM Integration Key).
      3. In the User Name field, enter the OCM integration user (the one you used to create the OCM root folder earlier) that is used to communicate with OCM (this must be an enterprise user in OCM).
      4. In the Password field, enter the OCM integration user password.
      5. Click OK.
    6. Click Save and Close.

OCMSearchUserService

To create the OCM search user web service, on the Create REST Web Service Connection page, complete the following fields:
Description of searchuser.png follows
Description of the illustration searchuser.png

  1. In the Name field, specify the name of the search user as OCMSearchUserService.
  2. In the URL field, specify the URL of the search user as https://<OCMServerURL>/documents/api/1.2/users/items?info=##userName##. Where <OCMServerURL> is the Oracle Content Management server that is used for this integration.
  3. In the Authentication Scheme section, select the Call using IDCS OAUTH option and use the same values as used above for the IDCS OAUTH parameters.
  4. In the Select and Configure Methods against Resource section, select the GET check box.
  5. In the Response Payload section, select the Code Sample option and add {} to the multi-line text box.

OCMSharedFolderUsersService

To create the OCM shared folder user's web service, on the Create REST Web Service Connection page, complete the following fields:
Description of sharedfolder.png follows
Description of the illustration sharedfolder.png

  1. In the Name field, specify the name of the shared folder user as OCMSharedFolderUsersService.
  2. In the URL field, specify the URL of the shared folder user as https://<OCMServerURL>/documents/api/1.2/shares/##folderId##/items. Where <OCMServerURL> is the Oracle Content Management server that is used for this integration.
  3. In the Authentication Scheme section, select the Call using IDCS OAUTH option and use the same values as used above for the IDCS OAUTH parameters.
  4. In the Select and Configure Methods against Resource section, select the GET check box.
  5. In the Response Payload section, select the Code Sample option and add {} to the multi-line text box.

OCMShareFolderService

To create the OCM share folder web service, on the Create REST Web Service Connection page, complete the following fields:
Description of share-folder.png follows
Description of the illustration share-folder.png

  1. In the Name field, specify the name of the share folder user as OCMShareFolderService.
  2. In the URL field, specify the URL of the share folder user as https://<OCMServerURL>/documents/api/1.2/shares/##folderId##. Where <OCMServerURL> is the Oracle Content Management server that is used for this integration.
  3. In the Authentication Scheme section, select the Call using IDCS OAUTH option and use the same values as used above for the IDCS OAUTH parameters.
  4. In the Select and Configure Methods against Resource section, select the POST check box.
  5. In the Request Payload section, select the Code Sample option and add {} to the multi-line text box.
  6. In the Response Payload section, select the Code Sample option and add {} to the multi-line text box.

OCMDeleteFolderService

To create the OCM delete folder web service, on the Create REST Web Service Connection page, complete the following fields:
Description of deletefolder.png follows
Description of the illustration deletefolder.png

  1. In the Name field, specify the name of the folder as OCMDeleteFolderService to be deleted.
  2. In the URL field, specify the URL of the delete folder as https://<OCMServerURL>/documents/api/1.2/folders/##folderId##. Where <OCMServerURL> is the Oracle Content Management server that is used for this integration.
  3. In the Authentication Scheme section, select the Call using IDCS OAUTH option and use the same values as used above for the IDCS OAUTH parameters.
  4. In the Select and Configure Methods against Resource section, select the DELETE check box.
  5. In the Response Payload section, select the Code Sample option and add {} to the multi-line text box.

Create Global Functions

Global functions are used to wrap business logic around the web services so that they can easily be used in other locations.

OCMCreateFolderFunction

To create the OCM create folder global function that will use the OCMCreateFolderService web service:

  1. Choose Common Setup and then Global Functions from the left navigation menu.
  2. On the Global Functions page, click the Add a Global Function icon.
  3. On the Create Global Function page, complete the following fields:

    1. In the Function Name field, specify the name of the function as OCMCreateFolderFunction.
    2. Select String from the Returns drop-down menu.
    3. In the Description field, enter the text “Creates a new OCMFolderName folder in OCM under the specified OCMParentFolderId and returns the newly created folder ID.”.
    4. In the Parameters section, click the Add Parameter icon.

      In the Name field, specify the name as OCMParentFolderId and select String from the Type drop-down menu.

    5. In the Parameters section, click the Add Parameter icon.

      In the Name field, specify the name as OCMFolderName and select String from the Type drop-down menu.

    6. In the Edit Script field, paste the following script:
      def OCMFolder = [:]
      try {
        OCMFolder = adf.webServices.OCMCreateFolderService.POST(OCMParentFolderId, OCMFolderName)
        println("OCM Folder Created: " + OCMFolder)
        return OCMFolder.id   
      } catch (Exception e) {
        println("Create OCM Folder Error: " + e)
      }
    7. Click Save and Close.

OCMSearchUserFunction

To create the OCM search user global function, in a new Create Global Function page, that will be used to access the OCMSearchUserService web service, complete the following fields:
Description of searchuserfunction.png follows
Description of the illustration searchuserfunction.png

  1. In the Function Name field, specify the name of the function as OCMSearchUserFunction.
  2. Select String from the Returns drop-down menu.
  3. In the Description field, enter the text “Searches for a user in OCM by the specified userName and returns that User's Id.”.
  4. In the Parameters section, in the Name field, specify the name as userName and select String from the Type drop-down menu.
  5. In the Edit Script field, paste the following script:
    def response = [:]
    try {
      response = adf.webServices.OCMSearchUserService.GET(userName)
      def responseItems = [:]
      responseItems = response.items
      println("OCM Search User Result: " + responseItems.getAt(0))
      return responseItems.getAt(0).id
    } catch (Exception e) {
      println("Search OCM User Error: " + e)
    }
  6. Click Save and Close.

OCMIsFolderSharedFunction

To create the OCM share folder global function, in a new Create Global Function page, that will be used to access the OCMSharedFolderUsersService web service, complete the following fields:
Description of ocmis.png follows
Description of the illustration ocmis.png

  1. In the Function Name field, specify the name of the function as OCMIsFolderSharedFunction.
  2. Select Boolean from the Returns drop-down menu.
  3. In the Description field, enter the text “Returns true if the specified OCMUserId has been shared to the specified OCMFolderId.”.
  4. In the Parameters section, add the following values:
    Name Type
    OCMFolderId String
    OCMUserId String
  5. In the Edit Script field, paste the following script:
    def response = [:]
    try {
      response = adf.webServices.OCMSharedFolderUsersService.GET(OCMFolderId)
      def responseItems = [:]
      responseItems = response.items
      for (item in responseItems) {
        if (item['type'] == 'share') {
          if (item['user']['id'] == OCMUserId) {
            return true
          }
        }
      }
      return false
    } catch (Exception e) {
      println("OCM Folder Shared Error: " + e)
      return false
    }
  6. Click Save and Close.

OCMShareFolderFunction

To create the OCM share folder global function, in a new Create Global Function page, that will be used to access the OCMShareFolderService web service, complete the following fields:
Description of sharefolderfunction.png follows
Description of the illustration sharefolderfunction.png

  1. In the Function Name field, specify the name of the function as OCMShareFolderFunction.
  2. Select Boolean from the Returns drop-down menu.
  3. In the Description field, enter the text “Shares the specified OCMFolderId in OCM with the OCMUserId and OCMRole specified returning true if successful.”.
  4. In the Parameters section, add the following values:
    Name Type
    OCMFolderId String
    OCMUserId String
    OCMRole String
  5. In the Edit Script field, paste the following script:
    def params = [:]
    params.userID = OCMUserId
    params.role = OCMRole
    def response = [:]
    try {
      response = adf.webServices.OCMShareFolderService.POST(OCMFolderId, params)
      if (response.errorCode == "0") {
        println("OCM Folder Shared: " + OCMFolderId + "(" + OCMUserId + ":" + OCMRole + ")")
        return true
      } else {
        println("Share OCM Folder Failed: " + OCMFolderId + "(" + OCMUserId + ":" + OCMRole + ")")
        return false
      }
    } catch (Exception e) {
      println("Share OCM Folder Error: " + e)
      return false 
    }
  6. Click Save and Close.

OCMDeleteFolderFunction

To create the OCM share folder global function, in a new Create Global Function page, that will be used to access the OCMDeleteFolderService web service, complete the following fields:
Description of ocmdelete.png follows
Description of the illustration ocmdelete.png

  1. In the Function Name field, specify the name of the function as OCMDeleteFolderFunction.
  2. Select Boolean from the Returns drop-down menu.
  3. In the Description field, enter the text “Deletes the specified OCMFolderId in OCM.”.
  4. In the Parameters section, in the Name field, specify the name as OCMFolderId and select String from the Type drop-down menu.
  5. In the Edit Script field, paste the following script:
    def response = [:]
    try {
      adf.webServices.OCMDeleteFolderService.DELETE(OCMFolderId)
      println("OCM Folder Deleted: " + OCMFolderId)
      return true
    } catch (Exception e) {
      println("Delete OCM Folder Error: " + e)
      return false 
    }
  6. Click Save and Close.

Create a Mashup

A Mashup is a window into an independent external application such as OCM.

To create a Mashup to embed the OCM embedded UI so that it can be exposed in an Oracle Sales and Service business object:

  1. Choose Common Setup and Mashup Content from the left navigation menu.
  2. On the Mashup Content: Web Applications page, click the Register Web Application button.
  3. On the Register Web Application page, complete the following fields:

    1. In the Name field, specify the name of the application as OCMEmbeddedFolderUIMashup.
    2. For the Type field, select the Groovy Expression option.
    3. In the URL Definition field, enter the OCM embedded UI URL as https://<OCMServerURL>/documents/embed/v2/folder/. Where <OCMServerURL> is the Oracle Content Management server that is used for integration.
    4. Click Save and Close.