Hi there
I would like to find out if one can add more parameters to the 'crud' methods in the business entity?
Also, can you add extra methods into a business entity?
Thanks,
Meyrick
Hi there
I would like to find out if one can add more parameters to the 'crud' methods in the business entity?
Also, can you add extra methods into a business entity?
Thanks,
Meyrick
Flag this post as spam/abuse.
Do you have an example on how to make your own REST calls?
As Mike said, the REST adapter can map [almost] anything in a HTTP message/response to a procedure/class method parameter list. Some restrictions apply... I'll supply some background information that may be useful to you before getting started.
The process for generating a pure REST API to an AppServer is similar in nature to what happens with a Mobile project. The Mobile tooling simply enforces a bunch of static mapping rules (like not being able to configure your own parameters) to make REST transparent and simple, just like it is suppose to do. When you create your own REST API the PDSOE tooling cannot make any assumptions regarding any of the mapping. You, the developer, are in 100% control of very aspect of the mapping and therefore have to manually configure it all. Some of the penalty for any-to-any mapping ability I guess.
As Mike also said, you lose the value gained by using the JSDO in your clients. Your client will then be expected to manually generate the correct HTTP requests and handle the HTTP responses.
In the 11.2/11.3 OpenEdge Development: Web Services you will find information about REST applications, annotating your ABL code, parameter mapping to HTTP request/response, and JSON structuring. It is worth reviewing that before diving straight into the PDSOE project.
You can start with your Mobile project and add REST 'service interfaces' and use PDSOE's mapping tool. I often do this so that one web application deployment can be used for both types of clients. You do not have to start a new project just to add REST support. That decision is yours.
Hope this helps.
Hi meyrick,
Yes. Extra methods can be added to the Business Entity file using 'Add method' dialog and thus mobile annotations can be added to the same using 'Define Service Interface' wizard.
Only one method pertain to each CRUD operation is allowed for a single Business Entity file ie., one Create, One Read, One Update and One Delete methods. However, there are no restrictions for the number of INVOKE (operation) methods in a single Business Entity file.
Thanks and Regards,
Anil Kumar.
Hi Meyrick,
You can create additional methods in the Business Entity and mark them as Invoke methods. This allows you to pass any number of parameters and the JSDO will continue to do its majic.
The only trick is that you will need to call AddRecords on the JSDO when you do a customer read invoke operation to get the records into the JSDO memory.
For the other CUD invoke operations, you can manage them your self BUT you will lose a lot of the JSDO features that are built in like local before-image and error handling.
-Shelley
Meyrick,
Let me ask one question: Do you know how to implement Invoke Methods? If not, maybe help on this topic will be more productive to you.
Invoke methods are an easy way to achieve what you asking.
If you are only doing Read, you don't even need to call the AddRecords, otherwise (if you are planning to create, update, delete using the CRUD operations with what you Read), then you would need it. Invoke is not the most straight forward to implement, but once you use it for the first time, it becomes very easy. I was thinking about recording a video showing how to do an Invoke implementation, just did not have time (or could put up with my on accent) to do it.
Something else I've done in the past is to pass multiple parameters in a READ (for example) using a pipe delimiter. Than I would parse it in the backend and avoid INVOKE.
thanks for all the help. Ricardo, I have also been using the pipe delimiter. Its seems to be the most simplest way. I do not know how to implement invoke methods. All i was wanting to do is add extra read methods to my business entity.
thanks for all the help. Ricardo, I have also been using the pipe delimiter. Its seems to be the most simplest way. I do not know how to implement invoke methods. All i was wanting to do is add extra read methods to my business entity.
Flag this post as spam/abuse.