This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Extending Application Subscribing Workflow

You can attach a custom workflow for the Web application subscribing process in WSO2 App Manager, with the integration of WSO2 BPS as follows.

Configuring WSO2 Business Process Server

Follow the steps below to configure WSO2 BPS to extend the publishing workflow of a Web app.

  1. Download WSO2 Business Process Server.    
  2. Enter 2 as the value of the <Offset> element in the <BPS_HOME>/repository/conf/carbon.xml file, to set a port offset of 2 to the default WSO2 BPS port.     

    This prevents port conflicts that occur when you start more than one WSO2 products on the same server. 

    If you change the port offset of WSO2 BPS to a value other than 2, or run the App Manager and BPS on different machines (hence to set the hostname to a different value than localhost), you must do the following.

    • Search and replace the value 9765 (i.e. the default value), in all the (.epr) files inside the <AppM_HOME>/business-processes/epr/ directory with the new offset value of the WSO2 BPS port.

    • Search and replace port 9445 (i.e. the default value), in the <AppM_HOME>/repository/deployment/server/jaggeryapps/admin-dashboard/site/conf/site.json file with the new offset value of the WSO2 BPS port accordingly.

    • Change the hard-coded endpoints of default APIs, and the port of the Workflow Callback Service as described in Changing the Default Ports with Offset.

  3. Create a directory named epr inside the  <BPS_HOME>/repository/conf/ directory.

  4. Copy the following files from <AppM_HOME>/business-processes/epr/ directory to <BPS_HOME>/repository/conf/epr/ directory.

    • SubscriptionCallbackService.epr
    • SubscriptionService.epr
  5. Start WSO2 BPS server, and log in to its management console using the following URL: https://<BPS_HOST>:<BPS_PORT>/carbon.

  6. In the Main menu, click Add under Processes.
  7. Click Choose File, and select the <AppM_HOME>/business-processes/publish-application/BPEL/SubscriptionApprovalWorkFlowProcess_1.0.0.zip file, to upload the business process archive file as follows.
    add new BPEL
  8. Click Upload.
  9. In the Main menu, click Add under Human Tasks.
  10. Click Choose File, and select the <AppM_HOME>/business-processes/publish-application/HumanTask/PublishAppApprovalTask-1.0.0.zip file, to upload the human task archive file as follows.
    add new human task
  11. Click Upload.

Configuring WSO2 App Manager

Follow the steps below to configure WSO2 AppM to extend the subscribing workflow of a Web app.

  1. Start WSO2 AppM server, and log in to its management console using the following URL: https://<AppM_HOST>:<AppM_PORT>/carbon.

  2. In the Main menu, click Browse under Resources.
  3. Navigate to /_system/governance/appmgt/applicationdata/workflow-extensions.xml file as shown below. 
    browse resources
  4. Click Edit as Text.
  5. Comment the default PublishAPPSimpleWorkflowExecutor, and comment out the PublishAPPWSWorkflowExecutor as shown below.

      <!--publishapp executor="org.wso2.carbon.appmgt.impl.workflow.PublishAPPSimpleWorkflowExecutor"-->
      <PublishAPP executor="org.wso2.carbon.appmgt.impl.workflow.PublishAPPWSWorkflowExecutor">
        <Property name="serviceEndpoint">http://localhost:9765/services/PublishAppApprovalWorkFlowProcess/</Property>
        <Property name="username">admin</Property>
        <Property name="password">admin</Property>
        <Property name="callbackURL">https://localhost:8243/services/WorkflowCallbackService</Property>
      </PublishAPP>
  6. Specify the service endpoint where the workflow engine is hosted and the credentials required to access the said service via basic authentication (i.e., username/password based authentication) in the above configuration.
  7. Click Save Content.

Trying out the workflow configuration

Follow the steps below to try out the workflow configuration enabled above on subscribing to a Web application.

  1. Start WSO2 AppM server, and log in to its management console using the following URL: https://<AppM_HOST>:<AppM_PORT>/carbon.

  2. Create a user with the internal/creator role. For instructions on creating a user, see Configuring Users.
  3. Log in to the App Publisher as the creator user created above using the following URL: http://<AppM_HOME>:<AppM_PORT>/publisher
  4. Create a Web Application. For instructions on creating a Web app, see Creating Web Applications.

  5. Create a user with the internal/publisher role. For instructions on creating a user, see Configuring Users.
  6. Log in to the App Publisher as the publisher user created above using the following URL: http://<AppM_HOME>:<AppM_PORT>/publisher
  7. Click Approve for the corresponding application in the list, and then click Publish.
  8. Create a user with the internal/subscriber role. For instructions on creating a user, see Configuring Users.
  9. Log in to the App Store as the subscriber user created above using the following URL: http://<AppM_HOME>:<AppM_PORT>/store
  10. Click on the published application in the App Store.

    This action invokes the Web application subscribing process and creates a human task instance that holds the execution of the BPEL process until you perform some action on it. Even for a user with the internal/subscriber role, the Subscribe button will not appear. This is because, the subscriber does not have the control of subscribing to the application while they are waiting for admin approval or rejection.

  11. Create a user with the internal/admin role. For instructions on creating a user, see Configuring Users.
  12. Log in to the WSO2 AppM admin dashboard as the admin user created above using the following URL: https://<AppM_HOME>:<AppM_PORT>/admin-dashboard
  13. Click Pending Workflows, and then click Pending Subscriptions.
  14. Select Approve on the corresponding Web app in the Approval Tasks list as shown below, and click Complete. 
  15. Refresh the App Store while being logged in as the user created above with the internal/subscriber role.
  16. Now you can click Subscribe to subscribe to the approved app.Â