-
Notifications
You must be signed in to change notification settings - Fork 27
How to create a Data Object Service in PDSOE to use with the JSDO
edselg edited this page Dec 2, 2022
·
2 revisions
Prerequisites:
- OpenEdge Developer Studio (PDSOE)
Steps
- Create a copy of the sports2020 database in your OpenEdge working directory.
cd C:\OpenEdge\WRK
prodb sports2020 sports2020
Steps
- Launch Progress Developer Studio.
- Create a new OpenEdge project with the following values: Project name: Sports Category: Server/WEB [x] Create a Data Object Service (Generate a JSDO catalog)
- Use default values in the following pages:
- ABL Web App deploy details
- Create an ABL Service
- Select an AVM and layout options
- Define PROPATH
- At the Select database connections page, click on Configure database connections.
- Click on New to create a new database connection.
- Create a new database connection with the following values: Connection name: sports2020 Physical name: C:\OpenEdge\WRK\sports2020.db Host name: localhost Service/Port: 20000
- Use default values in the following pages:
- Define a SQL connection
- Add SQL Connection Profile
- At the Define Database Server Configuration
- Click on Finish.
- Click on Apply and Close.
- Select the sports2020 database connection from the list.
- Click on Finish.
Steps
- Click on File > New > Business Entity.
- Specify the following values for the new business entity:
- Package root: \Sports\AppServer
- Business entity name: Customer
- Next to Select a schema file. Set the following values:
- Operations: (x) CRUD and Submit
- (x) Select database table:
- Connection: sports2020
- Table: Customer
- Click on Finish.
- Using the Project Explorer view, expand the Sports project and edit the SportsService under Defined Services.
- Next to Create a Data Object service page. Select the Customer.cls from the list.
- Click on Finish.
Steps
- From Servers view, double-click on the oepas1 instance to open the Overview page.
- Click on Open launch configuration.
- Click on Databases.
- Select Show all.
- Select the sports2020 database from the list.
- Click on OK.
Steps
- From Servers view, right-mouse-click on the oepas1 instance and click on Start.
Steps
- From Servers view, expand the oepas1 instance.
- Right-mouse-click on the SportsService item and click on Open Catalog URL. The JSDO catalog is shown in a web browser (http://localhost:8810/Sports/static/SportsService.json)
- Enter URL http://localhost:8810/Sports/web/pdo/SportsService/Customer to access the data from the Customer table.
Steps
- Download progress.all.min.js library from https://github.com/progress/JSDO/blob/master/lib/progress.all.min.js and copy it to the PASOEContent/static folder in the project.
- Create a test.html HTML File with the following content:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>JSDO Example</title>
<script src="./progress.all.min.js"></script>
<script src="./test.js"></script>
</head>
<body>
</body>
</html>
- New files are published to the PASOE instance automatically (by default 15 seconds after an update).
/* global progress */
var
serviceURI = "http://localhost:8810/Sports",
catalogURI = "http://localhost:8810/Sports/static/SportsService.json";
progress.data.getSession({
serviceURI: serviceURI,
catalogURI: catalogURI,
authenticationModel: "anonymous"
}).then(function (/* object */) {
var jsdo = new progress.data.JSDO({ name: 'Customer' });
jsdo.read("CustNum < 3125").then(function (object) {
object.jsdo.ttCustomer.foreach(function (customer) {
//console.log(jsdo.ttCustomer.Name);
document.write(customer.data.CustNum
+ ' ' + customer.data.Name + ' '
+ customer.data.Balance + '<br>');
});
}, function () {
console.log("Error while reading records.");
});
}, function () {
console.log("Error while creating session.");
});
- Access the test program using the URL http://localhost:8810/Sports/static/test.html. The specified records will be shown on the screen.
- DataSource API
- Starter Template Tutorial
- Using the JSDO component with plain HTML and JavaScript
- Using the JSDO and DataSource components with an existing NativeScript app
- Using the JSDO and DataSource components in an Angular web app (Angular-5.x)
- Using the JSDO and DataSource components in an Angular web app (Angular-6.x)
- Using the JSDO and DataSource components in a Node.js app