Business Process as a Service (BPaaS)

BPaaS provides REST API that can be used for programmatic invocation of Sterling B2B Integrator Business Processes configured with the non-queue based option.

Introduction to BPaaS

Sterling B2B Integrator business processes (BP) should be defined with the option Use BP Queuing unchecked, that is, Start Mode should be Sync.

Note: For REST API authorization, only basic authentication is supported.
Basic authentication is performed using the Sterling B2B Integrator username and password against the Sterling B2B Integrator database or external users on LDAP.

You can invoke a BPaaS Rest API by passing the custom request headers and payload, both of which are optional. The URL contains the API name, and the API name is mapped to the BP name. You can configure the mapping between the API and the BP in property file bpaasmapping.properties.

Request format:
 https://1.1.1.1:<Liberty https port>/bpaas/v1/<APIName>
Example,
https://1.1.1.1:8043/bpaas/v1/paymentprocessing

If you provide custom request headers, they will be placed inside the BP instance data section under the BPRequestHeaders node. Additionally, a few standard request headers will be also copied to the instance data, which are configurable in the bpaasmapping.properties and bpaas.properties files. The HTTP method name is added to process data.

Process data format:
<?xml version=”1.0” encoding="UTF-8"?> 
<ProcessData> 
  < BPRequestHeaders> 
    <httpmethod>POST</httpmethod> 
    <vendor>My Company</vendor> 
    <location>USA</location> 
    <financialyear>2022-2023</financialyear> 
  </BPRequestHeaders> 
</ProcessData>
Note: The process data headers can be referenced inside the BP definition using XPATH syntax.

If a request payload is provided, it will be set as the primary document to run the BP.

Optionally, you can also add a BPResponseHeaders section inside a process data section. BPResponseHeaders will contain a list of headers that will be sent back as a response header, and a flag to notify if the primary document should be sent as response body.

BP Definition Snippet

<operation name="AssignService"> 
    <participant name="AssignService"/> 
        <output message="AssignOutputMessage"> 
            <assign to="." from="*"/> 
            <assign to="BPResponseHeaders/proposedamount">12345</assign> 
            <assign to="BPResponseHeaders/currency">USD</assign> 
            <assign to="BPResponseHeaders/mode">partial</assign> 
            <assign to="BPResponseHeaders/ReturnPrimaryDocument">true</assign> 
        </output> 
        <input message="AssignInputMessage"> 
            <assign to="." from="*"/> 
        </input> 
</operation>

Process Data

The following is an example of process data:
<?xml version="1.0" encoding="UTF-8"?> 
<ProcessData> 
  <PrimaryDocument SCIObjectID="6973361875ae10763node1"/> 
  <BPRequestHeaders> 
    <vendor>My Company</vendor> 
    <location>USA</location> 
    <financialyear>2022-2023</financialyear> 
  </BPRequestHeaders> 
  <BPResponseHeaders> 
    <proposedamount>12345</proposedamount> 
    <currency>USD</currency> 
    <mode>partial</mode> 
    <ReturnPrimaryDocument>true</ReturnPrimaryDocument> 
  </BPResponseHeaders> 
</ProcessData> 
The ReturnPrimaryDocument element is used to return a primary document, if available, as a response body.
Note: It is not mandatory to provide custom request headers/body or to return any response headers/body.

You can return the required HTTP status code by adding status-code under BPResponseHeaders. By default, the status returned is 200 OK, unless there are issues with permissions or a failure to run the BP. You can also add a onFault section inside the BP definition and set the required status-code.

In case of an error scenario, you can return the primary document by setting the xport-doc-on-error parameter to true. Example:
<BPResponseHeaders> 
    <proposedamount>12345</proposedamount> 
    <currency>USD</currency> 
    <status-code>503</status-code> 
    <xport-doc-on-error>true</xport-doc-on-error> 
    <ReturnPrimaryDocument>true</ReturnPrimaryDocument> 
  </BPResponseHeaders>

HTTP Actions

The following actions are supported and the action name is copied to business process instance data:
  • GET
  • POST
  • DELETE
  • PUT
Note: As a BP writer, you can choose to adhere to any/all combination of the above HTTP actions.

API Permissions

You must define the API permissions in the UI and assign it to the user or a user group.

The following is an example of permissions defined for the paymentprocesssing API based on the supported HTTP method:
  • GET → paymentprocesssing/VIEW
  • POST → paymentprocesssing/CREATE
  • DELETE → paymentprocesssing/DELETE
  • PUT → paymentprocesssing/UPDATE

Request Format

/bpaas/v1/<API Name>
The authorization header will contain basic authorization details. Example:
POST /bpaas/v1/paymentprocessing HTTP/1.1 

Host: 1.1.1.1:8043 

Content-Type: application/octet-stream 

vendor: My Company 

Authorization: Basic YXBpdXNlcjpwYXNzd29yZA== 

Content-Length: 22 

"<file contents here>" 

BP Execution Timeout

The configuration for the default BP execution timeout (in milliseconds) is specified in the bpass.properties file.

You can override the default value by specifying the timeout at an individual API level in the bpaasmapping.properties file.

Rate Limiting

The default number of threads, known as workerthreads, configured for BP execution is specified in the bpaas.properties file.

Each BPaaS server allocates the number of threads defined in workerthreads and these threads will run the BP. If all the threads are busy, any request to run the BP is rejected and a 503 error code is sent to the client. Therefore, you must configure the workerthreads parameter based on the maximum number of BP executions expected at any point of time.

Export/Import of Business Processes

BPs exported prior to the release of Sterling B2B Integrator v6.2.0 will not import the sync BP definitions correctly. Therefore, you must export the BP definitions from one environment (v6.2.0) and then import them on another environment (v6.2.0). Alternatively, you can edit the Async versions and save them as a different version without any modifications.