Doorgaan naar hoofdcontent

Cordys BOP4: Database connector

Introduction

Just like any other Enterprise Service Bus, Cordys BOP4 also has connectors like file, ftp, mail and database.
This blog item shows how a database connector is configured within the product.

Note:
Within a Service Oriented Architecture that must be flexible and product independant I would advise not to use product specific
database connectors. I would recommend to implement an abstraction layer around the database with for instance Hibernate and expose it as a webservice.

Ws-AppServer

Within the Cordys BOP4 platform a database connector is implemented with a so-called Ws-AppServer. This is a java layer between the database and can be used to implement some business logic
and/or the place to react on database events.

For this example I have used a MySql database instance (Test) with an Employee table.

DROP TABLE IF EXISTS test.Employee;

CREATE TABLE test.Employee (
  EmployeeNumber varchar(255) NOT NULL DEFAULT '',
  FirstName varchar(255) NOT NULL DEFAULT '',
  LastName varchar(255),
  BirthDate date NOT NULL,
  PRIMARY KEY (EmployeeNumber)
); 

INSERT INTO `test`.`Employee` (EmployeeNumber, FirstName, LastName, BirthDate) VALUES (1,'Roger', 'van de Kimmenade', '1971-12-04');

Database Configuration

First we will create a database configuration which contains the database connection properties.
  1. Goto System Resource Manager

  2. Select Manage Database Configurations

  3. Select Insert Button

  1. Select MySql and fill database properties. Select green button to test the connection.
    Select Save to save this configuration.


Service Group

Next we will create a Service Group (WS-AppServer) that is the connection pool to the database.
  1. In the System Resource Manager goto Show all service groups

  2. Select Plus sign

  3. Select WS-AppServer as application connector and click Next

  1. Fill in Name and Select all Web Service Interfaces and click Next

  1. Fill in Name and select Automatic as Startup Type. Click Next.

  1. Check Configure Database and select the database configuration created above (Employee database). Click Next.
Notes:
  • The Initializer Class Name is the name of the class that implements theiOnBsfConnectorinterface. This helps you implement custom logic that will run whenever WS-AppServer starts or stops. 

  1. Leave defaults and click Finish.

Database Metadata

Now we can generate a Database MetaData object that represents the structure of a database. It uses the metadata service to connect to the database and get the details.

  1. Create a Metadata Folder in you workspace

  2. Right click on the Folder and select Database Metadata document

  1. Select the Ws-AppServer service and click Save

  1. Fill in Name and Description and click Save

  1. The database tables are loaded and shown. You can click on a table to view the columns. You can Save and close the window.

Generating webservice operations

Now we are ready to generate webservice operations on the database tables.
There are three ways to do that, but i will only describe the first in this blog item.
  1. Generate Web Service Operations directly on the database
  2. Generate Java Code (WS-AppServer package)

  1. Generate Custom Web Service Operation

To generate webservice operations on the tables you have to do the following:
  1. Create a Web Services Folder

  2. Right click on the Employee Database Metadata and select Generate Web Service Operations

  1. Select the table on which the operations must be generated. In this case only one table (employee) is present. And click Finish.


  1. When you look in the Web Services Folder you can see the generated data and webservice operations

This concludes this blog about generating webservices on your database.

Reacties

  1. Hey..have you used embeded wisapp to communicate witht the db.. ?

    BeantwoordenVerwijderen
  2. Hell Bijesh,

    No i have not done that yet.
    Did you have problems with it?
    I will try after my holidays ;)

    Regards
    Roger

    BeantwoordenVerwijderen
  3. Deze reactie is verwijderd door de auteur.

    BeantwoordenVerwijderen
  4. Yes in ,Working with multiple configurations in EMBEDDED wsapps.. i have two database configrations and im trying to communicate with different databases inside a function.. but its communicating always to the first set db..
    There is an article in wiki already mentioning about this issue..
    check this https://wiki.cordys.com/display/cui/XForm+File+Uploads+and+Downloads+to+Database?focusedCommentId=179308227#comment-179308227
    That solution is also help full for me.. i dont have a multi threaded scenario .. My Bop is CU6

    BeantwoordenVerwijderen
  5. Hi Roger van de Kimmenade,
    am new for Cordys bop4. am trying to configure database (i want to create new database in cordys) through system resources but its showing error like " 500 - ns0:Server :Configuration validation was not successful. " Can you please tell me whats wrong is going ? and please suggest any links or tutorials for learn cordys from scratch

    Thanks..

    BeantwoordenVerwijderen
    Reacties
    1. Hello Bharat,

      Please look at the wiki.cordys.com (you can register for free).
      Then goto https://wiki.cordys.com/display/acorg/Cordys+Fundamentals+BOP+4.1 and there you will find the fundamentals training.

      Good luck !

      Regards, Roger

      Verwijderen

Een reactie posten

Populaire posts van deze blog

OSB 10gR3 and SWA and MTOM

This blog is about using soap with attachments and the use of MTOM within the OSB (10gR3). A service is created that accepts a soap with attachment (DocumentService) and translates it to a service that accepts a binary element. MTOM is used for performance reasons for the second. Some notes: * For the use of attachments you need RPC-style document instead of the usual document-style. This due to the fact that the document-style limits a message to a single . * A service can not have both SWA and MTOM within OSB. First a WSDL is setup for the DocumentService: The $attachments variable holds the attachments and the body holds the attachment data. Also other data is stored within the attachment element (see h...

Microservices mindmap

"The tree" - See also   my photo page When you are fairly new within the Microservices land, there are a lot of terms fired at you. So also for my own understanding i have made a mindmap. I think it has a good status now, so that i can share it with you. As always feedback is very welcome ! You can download the mindmap here .

Book review: Data Management at Scale (Piethein Strengholt)

 This blog is a review of the book "Data Management at Scale (See also at bol.com ) Data Management is a hot topic nowadays and this book does a fantastic job at adding value to this topic. It is a must read and one of the few technical books I finished reading in a weekend. The book gives a fantastic overview on how to implement a Data Mesh data architecture. The Data Mesh concept is explained by Martin Fowler here . The book is a good mix between conceptual and implementation architecture level. It gives a lot of examples of how this architecture at scale can work, for both small and big companies. It is practical and I used it to implement it at one of my customers. The book describes an architecture in which the focus is on the DIAL (Data- and Integration Access Layer).  On a high level the book covers the following topics: The key principles for data management at scale - Domain-Driven Design  - Domain Data Stores - Meta data management Ready Data Store The concept ...