Service Action's Network and Security in ODC
There are some points that require attention when we think about Service Actions in O11.
I'll look into some of them in ODC.
- When called from another Server or Service Actions, how does a Service Action handle Authentication and Authorization
- Is the URL to a Service Action fixed?
- Does the URL sit under the path of a screen?
- Can we know that URL through logs on the ODC Portal?
- Can we handle Exceptions that are raised from a Service Action in a caller Action?
We can create a Service Action that just wraps a Server Action.
Here's a sample Server Action which just adds 1 to the Input Parameter and returns it.
First, Right click on the Action, then select "Expose as Service Action".
And I got this Service Action with the same Input and Output as the Server Action.
It calls the Server Action and sets its Output Parameter as the Output Parameter of itself.
A Service Action has the same login information as the caller App.
If we call a Service Action from a Screen and use the GetUserId Function, we get the same User Id like '81cf9d40-2160-479d-8bed-a23e82f530c4'.
If we are not logged in to the caller app, the Function will return a blank string.
Check URLs of Service Actions by calling a Service Action from the following places and see Request_GetURL.URL.
- Client Action -> https://<hostname>/<AppName>/screenservices/<AppName>/<UI Flow Name>/<ScreenName>/ServiceAPI<ServiceAction Name>
- Server Action, which is called from a Client Action under a Screen -> https://<hostname>/<AppName>/screenservices/<AppName>/<UI Flow Name>/<ScreenName>/Action<Server Action Name>
- Data Action -> https://<hostname>/<AppName>/screenservices/<AppName>/<UI Flow Name>/<ScreenName>/DataAction<Data Action Name>
- Timer -> http://localhost:8080/moduleservices/timers/<GUID?>/execution
- Expose REST API -> https://<hostname>/<AppName>/rest/<REST API Name>/<REST API Method Name> In short, it's the URL for a REST API Method
And here are the URLs I can find from Trace.
- Client Action -> http://svc-<GUID?>:8080/serviceapi/<ServiceAction Name>
- Data Action -> http://svc-<GUID?>:8080/serviceapi/<ServiceAction Name>
- Timer -> http://svc-<GUID?>:8080/serviceapi/<ServiceAction Name>
- Expose RESE API -> http://svc-<GUID?>:8080/serviceapi/<ServiceAction Name>
I can't find a Trace related to Server Action calls that includes a Service Action call. The reason is that the platform samples Traces.
I want to test the same with Public Entities, but I can't find a proper way.
So, I just tested Aggregate using Public Entity from another App on a Screen Aggregate by looking at the Developer Tools network tab.
https://<hostname>/<Consumer AppName>/screenservices/<Consumer AppName>/MainFlow/<Screen Name>/ScreenDataSet<Aggregate Name>
Notes: If I used an Aggregate to query from an Entity in another App, it ran SQL directly instead of calling a URL.