1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Using Progress JSDO with Angular CLI project

Discussão em 'StackOverflow' iniciado por fdantas, Agosto 1, 2017.

  1. fdantas

    fdantas Administrator Moderador

    I'm trying to create an Angular app as a client for an API that requires use of the Progress JSDO for interactions with the OpenEdge data through Business Entities. I'm pretty new to Angular development, but I'm fairly familiar with the Progress JSDO, so I have a feeling that my issue is rooted in how I'm including progress withing the project.

    I've found this example, which I believe is outdated:

    Progress Community Post

    Same with this PUG Challenge PDF:

    PUG Challenge PDF

    Here is the code that I'm using the interact with the JSDO:

    import { Injectable } from '@angular/core';

    import { Observable } from 'rxjs/Observable';
    import 'rxjs/add/observable/fromPromise';
    import 'rxjs/add/operator/map';

    import { progress } from 'jsdo';

    import { PriceResponse } from './oo-price-response';
    import { OOProduct } from './oo-product';

    //Products JSDO service
    @Injectable()
    export class OEWebPriceService {
    private tableName: string = 'Products';
    private jsdo: any;

    constructor() {

    const serviceURI = 'myServiceURI';
    const catalogURI = 'myCatalogURI';

    let session = new progress.data.JSDOSession({ serviceURI: serviceURI });

    session.login('devono|ulfoods.com','devono')
    .then(() => {
    session.addCatalog(catalogURI);
    });

    let productJSDO = new progress.data.JSDO({ name: 'Products' });
    this.jsdo = productJSDO;
    }

    public getPrices(): Observable<OOProduct[]> {
    return this.fetch();
    }

    private fetch(): Observable<OOProduct[]> {
    let ttPrices=[];

    let params = {
    accountNumber: "945873",
    ttPrice: {
    ttPrice: [
    { seq: 0, productCode: "152709"},
    { seq: 1, productCode: "717141"},
    { seq: 2, productCode: "152711"}
    ]
    },
    userLoginID: "devono|ulfoods.com"
    };

    let prodPromise = new Promise((resolve, reject) => {
    this.jsdo.invoke("GetPrices", params)
    .done( (jsdo: any, success: any, request: any) => {
    ttPrices = request.response.ttPrice.ttPrice;
    resolve(ttPrices);
    })
    });

    let result = Observable.fromPromise(prodPromise);

    return result;
    }
    }


    This code looks file in Sublime, with TypeScript recognizing all of the types and methods, etc, and everything compiles fine. However, within the browser I get an error message from Chrome Developer Tools:

    [​IMG]

    I feel like Progress can't find jQuery, even though jQuery came right along with it when I installed the JSDO to my project via npm. Is there a step I'm missing? Has anyone successfully included the JSDO in an Angular project who could lay out the steps?

    I'll try to get a working example up in Plunker or something, but I don't really know how to do that, so hopefully this will suffice for now.

    Thanks in advance!

    Continue reading...

Compartilhe esta Página