Object Import - JSDO - Forum - Rollbase - Progress Community

Object Import - JSDO

 Forum

Object Import - JSDO

This question is answered

Hi guys, we're trying to import a Rollbase object from JSDO and we're getting this odd error on second step

<<Trying to redirect committed response to appFromJSDO.jsp?errMsg=Obsolete+Catalog+file%3A+11.3+or+above+Mobile+Service+is+required>>

The catalog we save in a json file looks like this - http://sports.akera.io:8383/sports/rest/crud/jsdo/metadata/sports2000/customer 

Apparently Rollbase is able to read that on first step as in it does see the dataset/temp-table although oddly enough it only shows the 'create' operation for import, if we do next we are greeted with this error that leaves us clueless :(

The catalog version of JSDO on github spec project (https://github.com/CloudDataObject) seems to be 1.3 and this is how we generate the catalog, something obviously we're missing here?

Thanks.

Marian

Verified Answer
  • Hi Marian,

    The count operation is invoked as PUT call. So we need to specify verb as "put".

    Regards,

    Ranjana Sinha

  • Hello,

    The count operation expects a response from the server that looks like the following:

    {"response":{"numRecs":1312}}

    Here is a link to the documentation with a sample count method:

    documentation.progress.com/.../updating-business-entities-for-access-by-telerik.html

    Technically, the property holding the result does not have to be called "numRecs" but I wonder if Rollbase is specifically looking for it.

    Could you change your method to use "numRecs"?

    Regarding using GET vs PUT for INVOKE operations.

    The JSDO, via the catalog, can use INVOKE operations with GET.

    However, the Data Object support in PDSOE, the REST mapping, uses PUT for INVOKE operations. We would need to enhance PDSOE to use GET (or other verb) for INVOKE operations.

    In general, the client, whether it is the JSDO or Rollbase, should use the definition in the catalog to call the operations in the backend.

    I hope this helps.

All Replies
  • Hi Marian,

    The link sports.akera.io:8383/.../customer

    is not accessible.

    Could you please provide us the catalog you are using so that we can get back as to what is the issue.

    Regards,

    Ranjana Sinha

  • Hi Ranjana,

    the server was resting, sorry for that... the catalog for customer only looks like this

    {"version":"1.3","lastModified":"Wed Aug 17 2016 15:14:12 GMT+0300 (EEST)",
    "services":[{"name":"sports2000","address":"/rest/sports2000","settings":{"useRequest":true},
    "resources":[{"name":"customer","path":"/customer","displayName":"customer",
    "schema":{"type":"object","additionalProperties":false,"properties":{
    "dscustomer":{"type":"object","additionalProperties":false,"properties":{
    "ttcustomer":{"type":"array","primaryKey":["CustNum"],
    "items":{"additionalProperties":false,"properties":{"_id":{"type":"string"},
    "errorString":{"type":"string"},
    "Address":{"type":"string","title":"Address","format":"x(35)","ablType":"character","required":false},
    "Address2":{"type":"string","title":"Address2","format":"x(35)","ablType":"character","required":false},
    "Balance":{"type":"number","title":"Balance","format":"->,>>>,>>9.99","ablType":"decimal","required":false},
    "City":{"type":"string","title":"City","format":"x(25)","ablType":"character","required":false},
    "Comments":{"type":"string","title":"Comments","format":"x(80)","ablType":"character","required":false},
    "Contact":{"type":"string","title":"Contact","format":"x(30)","ablType":"character","required":false},
    "Country":{"type":"string","title":"Country","format":"x(20)","ablType":"character","required":false},
    "CreditLimit":{"type":"number","title":"Credit Limit","format":"->,>>>,>>9","ablType":"decimal","required":false},
    "CustNum":{"type":"number","title":"Cust Num","format":">>>>9","ablType":"integer","required":false},
    "Discount":{"type":"number","title":"Discount","format":">>9%","ablType":"integer","required":false},
    "EmailAddress":{"type":"string","title":"Email","format":"x(50)","ablType":"character","required":false},
    "Fax":{"type":"string","title":"Fax","format":"x(20)","ablType":"character","required":false},
    "Name":{"type":"string","title":"Name","format":"x(30)","ablType":"character","required":false},
    "Phone":{"type":"string","title":"Phone","format":"x(20)","ablType":"character","required":false},
    "PostalCode":{"type":"string","title":"Postal Code","format":"x(10)","ablType":"character","required":false},
    "SalesRep":{"type":"string","title":"Sales Rep","format":"x(4)","ablType":"character","required":false},
    "State":{"type":"string","title":"State","format":"x(20)","ablType":"character","required":false},
    "Terms":{"type":"string","title":"Terms","format":"x(20)","ablType":"character","required":false}}}}}}}},
    "operations":[{"path":"?filter={filter}&sort={sort}&skip={skip}&top={top}","type":"read","verb":"get","params":[{"name":"dscustomer","type":"REQUEST_BODY,RESPONSE_BODY"}]},{"path":"","useBeforeImage":false,"type":"create","verb":"post","params":[{"name":"dscustomer","type":"REQUEST_BODY,RESPONSE_BODY"}]},{"path":"","useBeforeImage":true,"type":"update","verb":"put","params":[{"name":"dscustomer","type":"REQUEST_BODY,RESPONSE_BODY"}]},{"path":"","useBeforeImage":true,"type":"delete","verb":"delete","params":[{"name":"dscustomer","type":"REQUEST_BODY"}]},{"path":"/count?filter={filter}","name":"count","type":"invoke","verb":"get","useBeforeImage":false,"params":[{"name":"count","type":"RESPONSE_BODY","xType":"number"}]}]}]}]}

    Thanks
  • No idea how this could be better formatted, the server should be working now though :(

  • A simple kendo grid with jsdo kendo data source works just fine though... http://sports.akera.io:8383/

  • Hi Marian,

    I looked into the JSDO. The issue is that the ablType is in lowercase. For example for the field "Address" the abltype should be "CHARACTER" and not "character".

    Please find the sample JSDO example for the fields :

                                   "CHARFLD8": {

                                       "type": "string",

                                       "ablType": "CHARACTER",

                                       "default": "?",

                                       "title": "?"

                                   },

                                   "DATEFLD": {

                                       "type": "string",

                                       "ablType": "DATE",

                                       "default": "2015-07-07",

                                       "title": "?",

                                       "format": "date"

                                   },

                                   "DECFLD1": {

                                       "type": "number",

                                       "ablType": "DECIMAL",

                                       "default": 0,

                                       "title": "?"

                                   },

                                   "DECFLD2": {

                                       "type": "number",

                                       "ablType": "DECIMAL",

                                       "default": 0,

                                       "title": "?"

                                   },

                                   "DECFLD3": {

                                       "type": "number",

                                       "ablType": "DECIMAL",

                                       "default": 0,

                                       "title": "?"

                                   },

    Could you please modify the JSON and then try. Let me know if you still face issues.

    Regards,

    Ranjana Sinha

  • Great catch, it does make sense though we still get bite by this… only because we’ve got spoiled with insensitiveness of good old 4gl :)

    One thing that confuses me still is although we’re specifying ‘get’ as verb in count method we seems to get the request as PUT… some other case sensitive typo or know of any reason why this might happen?

    Thank you.
     
    Marian Edu

    Acorn IT 
    +40 740 036 212

  • Hi Marian,

    The count operation is invoked as PUT call. So we need to specify verb as "put".

    Regards,

    Ranjana Sinha

  • Well, if that's the way to do it then guess we'll just have to accept the answer although it does make more sense to me to get the count over a GET request (Kendo does that) and it shouldn't be too much effort to parse that small bit of information from the JSDO catalog and use the right HTTP verb as per operation definition... otherwise at least make that clear in JSDO import documentation ;)

    Thanks

  • Hi Marian,

    I agree it makes more sense to mark count as a GET call. We will consider your suggestions. Thank you.

    Regards,

    Ranjana Sinha

  • Hi,

    At Openedge ABL end, getrecord count is an Invoke operation (User created method) and it is designed to use by PUT VERB.

    {

                           "name": "count",

                           "path": "\/count?filter={filter}",

                           "useBeforeImage": true,

                           "type": "invoke",

                           "verb": "put",

                           "params": []

    }

    Regards,

    Ganesh

  • Hi Ganesh, I do understand this is how it is implemented now so we've just changed the GET to PUT for time being (although I still think GET would make more sense)... anyway, what should we return to this? A simple number in the body? We specify a RESPONSE_BODY parameters as number with name 'count' and the result looks like this:

    {"count": 234}

    Kendo data source seems to be happy with it, Rollbase gives an error (no message really) when we set the imported object to support count operation :(

    If we just throw the count number in response body there is no error anymore but it also doesn't show any records afterwards... probably interpret the count to be zero.

    Bref, how the count response should look like?

    Thank you.

  • Hello,

    The count operation expects a response from the server that looks like the following:

    {"response":{"numRecs":1312}}

    Here is a link to the documentation with a sample count method:

    documentation.progress.com/.../updating-business-entities-for-access-by-telerik.html

    Technically, the property holding the result does not have to be called "numRecs" but I wonder if Rollbase is specifically looking for it.

    Could you change your method to use "numRecs"?

    Regarding using GET vs PUT for INVOKE operations.

    The JSDO, via the catalog, can use INVOKE operations with GET.

    However, the Data Object support in PDSOE, the REST mapping, uses PUT for INVOKE operations. We would need to enhance PDSOE to use GET (or other verb) for INVOKE operations.

    In general, the client, whether it is the JSDO or Rollbase, should use the definition in the catalog to call the operations in the backend.

    I hope this helps.

  • Hi Edsel,

    thanks for that... I can confirm both Rollbase and Kendo are now happy with the 'response'/'numRecs' response format :)

    Oddly enough if imported object does not support count operation when browsing the object in Rollbase there is one request with no pagination info (to retrieve all records) and then one more to retrieve the first page... while I do understand the need to know the total number of records I still see the second request not so necessarily as the full result was already retrieved before :(

    Anyway, we're getting close... this will make a nice wiki entry.

    Thanks again.

    Marian

  • Ah, did loved your last statement... 'in general' it should, but that's just theory :)