Integration

Develop a Synchronous Web Service with Dell Boomi

Develop a Synchronous Web Service with Dell Boomi

In this blogpost I will show how to build a synchronous web service with Boomi. A synchronous web service is used when a client or a calling system is expecting an immediate process response for a process request. The client is blocked until the web service sends a response or times out. Boomi allows us to expose an existing process as either a SOAP or a RESTful web service.

In this example I explain how to expose a RESTful web service to get customer data from a database. I use an Oracle XE database with example schemas installed. The customer table is located in the OE schema.

Prerequisites

  1. Setup vagrant image with local Atom and Oracle XE database (see previous post for details)
  2. Start Atom locally:

    cd /home/vagrant/Boomi_AtomSphere/Atom/Atom_javadev01_esentri_com/bin
    ./atom
    start

  3. JDBC Driver to access Oracle XE database must be provided as Custom Library as described in blog post TODO: Blogpost Reference CSV to Database  

Steps

    Login to AtomSphere in a web browser.

    Create a new folder Customer API in your account:

    Create a new component of type Database and name it Customer Database:


    Click
    Create.

    Database Connection Dialog appears:
    Driver Type: Custom
    Class Name: oracle.jdbc.OracleDriver
    User Name: oe
    Connection URL: jdbc:oracle:thin:@database:1521/XEPDB1 (depends on your environment!)
    Click
    Save.

    Note: Test the connection by clicking on the button Test Connection and select the appropriate environment.

    Create new component of type Connector Operation and name it Find Customer By Id:


    Click
    Create.

    Connector Operation dialog appears:
    Connector Action: Get
    Profile: Click on the green-plus icon.

    Use Customer as name for the new Database Profile. Click on Statement entry in the tree on the left
    side. Choose
    Select in Type and click on Import (upper-right-corner).

    Database Import Wizard appears:
    Browse in: Select the configured environment with database access
    Connection: Choose
    Oracle Customer
    Database
     (previously created)
    Schema Filter: OE
    Click
    Next.

    Select OE.CUSTOMERS from the list and click Next.

    Select all available columns and click Next and afterwards Finish.

    Add where-clause: WHERE CUSTOMER_ID=? At the end of the Select-Statement. Click Save.

    Add new parameter called Customer_Id under Parameters tree entry. Choose Character as Data Type. Afterwards click Save and Close.

    Create a new file with the name customer-example.json. Add the following content to the file and save it locally:

    {
    "Customer-ID" : "4711",
    "FirstName" :
    "Max",
    "LastName"
    : "Mustermann",
    "Street" : "Musterstreet 27",
    "PostalCode" : "97076",
    "City" :
    "Musterstadt"
    }

    Create a new component of type Process and name it Customer Manager:


    Click
    Create.

    Choose Web Services Server as Connector for the Start Shape. Also click on the link Make the recommended changes for me:


    Click on the green-plus-icon in the
    Operation field.

    Web Services Server Operation dialog appears:
    Rename it to
    Get Customer By Id
    Operation Type: QUERY
    Object: Customer
    Expected Input Type: Single JSON Object
    Response Output Type: Single JSON Object
    Click
    Save.
    Click green-plus-icon in field Request Profile

    JSON Profile dialog appears:
    Rename it to
    CustomerId Input.
    Add
    CustomerId as Simple Value Type as shown in the picture below. Click Save and Close.

    Click green-plus-icon in field Response Profile

    JSON Profile dialog appears:
    Rename it to
    Customer
    Click Import.

    Select file customer-example.json (previously created) and click Next. Confirm import with click on Finish.

    Check imported fields and then click Save and Close.

    Web Services Server Operation dialog appears again. Click Save and Close.

    Review Start Shape configuration and click OK.

    Add Connector Shape to process:
    Display Name: FindCustomerById
    Connector: Database
    Action: Get
    Connection: Choose
    Oracle Customer Database
    Operation: Choose
    Find CustomerById
    Click
    OK.

    Navigate to Parameters and click on plus-sign. Select Customer_Id from the list.

    Select CustomerId Input profile inside Profile field. Select CustomerId as Element. This configuration ensures, that the right id for the customer search will be used.

    Add Shape Return Documents to the process and click OK.

    Connect FindCustomerById with Return Documents and click Save.

     Add Map Shape to the process and use “Transform DB-Record to JSON” and click on the green-plus-sign in field Map.

    Rename the map to Customer Database to JSON. As source choose Database Profile Customer. As target choose JSON ProfileCustomer. Map the source to target fields as appropriate. Click Save and Close.

    Connect new Map Shape with FindCustomerById and Return Documents Shape.

    Before deploying the process ensure that a port is configured for Shared Web Server in your target environment.

    Deploy the process to your environment.

    Test the web service using the following command:

    curl --header "Content-Type:
    application/json" \
    --request POST \
    --data '{"CustomerId":"128"}' \
    http://localhost:8080/ws/simple/queryCustomer | jq '.'

    References