199
Views
6
Comments
Solved
Can I call service action in server action ?
Application Type
Service

I just tried to drag one of my service action in my server action in the same module but studio not allowed to drag that.

but when I drag another service module service action I am able to so can someone tell me why studio is allowing that for other module but not in the same module.

Same Module


Different Module

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

You should see a service action like a REST method. You use it for loose coupling of applications that shouldn't, architecturally, share data and modules. The advantages of a service action over a REST method is that its configuration is way easier: you can just consume it like any other action, and Service Studio will make it work (as opposed to consuming a REST API via an URL etc.). The downside is that it is still a reference, even if "loose".

The same question has come up before of course, and you can find various Medium articles about the subject.

There's nothing wrong with using a Service Action, as long as you realize the advantages and limitations (especially with regards to speed and transactions).

UserImage.jpg
Md Mansur

Hi @Navneet Garg

In OutSystems, exposing a Server Action generates a strong dependency from the consumer to the producer module, in a tightly-coupled way.Each time the implementation of an exposed Server Action changes, the consumer modules must be refreshed and republished to start using the latest version.

Exposing a Service Action generates a weak dependency from the consumer to the producer module, in a loosely-coupled way.Each time the implementation of an exposed Service Action changes, that change takes immediate effect in the consumer modules.

When you start having services that are reused by several applications, supporting different lines of business with independent release cycles, keeping all the modules tightly-coupled starts to be a burden in the deployment phase. so Outsystems not provided that feature to use service action module to tightly coupled but when we used service action in server action its not effect the producer module

link:

https://success.outsystems.com/documentation/11/building_apps/reusing_and_refactoring/use_services_to_expose_functionality/

Thanks

Md Mansur


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Navneet,

It is indeed not possible to use a Service Action that is defined in a module in that module itself. I don't think this is a technical limitation, but a functional one: it doesn't really make sense to do so (do admittedly, a warning instead of disallowing it would've been better).

A Service Action is used for loose coupling between modules. So using it in one module doesn't make (architectural) sense. Also, since Service Actions are implemented as REST APIs, they are much slower to invoke than normal actions.

So in your case, if you want to use the functionality in the module, but still expose it as a Service Action, create a Server Action with all the functionality (non-public), and call that action in both the Service Action and the local Action.

2022-12-30 07-28-09
Navneet Garg

So what if I use service action of other application. Is it ok as per best practice or good architecture or should we never use service action in server action at all ?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

You should see a service action like a REST method. You use it for loose coupling of applications that shouldn't, architecturally, share data and modules. The advantages of a service action over a REST method is that its configuration is way easier: you can just consume it like any other action, and Service Studio will make it work (as opposed to consuming a REST API via an URL etc.). The downside is that it is still a reference, even if "loose".

The same question has come up before of course, and you can find various Medium articles about the subject.

There's nothing wrong with using a Service Action, as long as you realize the advantages and limitations (especially with regards to speed and transactions).

2022-12-30 07-28-09
Navneet Garg
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.