Skip to main content
Understanding the service layers clarifies where to add validation, change behavior, or trace a bug. Darpan backend calls use Moqui JSON-RPC through /rpc/json. The method name is a Moqui service name, for example:

Layering

Remote surface

Facade services are granted to every signed-in Darpan user through the DARPAN_FACADE_APP artifact group. Each facade service then checks the active tenant and the caller’s role before it reads or writes. Admin services are granted only to super admins. Four facade services accept anonymous calls, all in AuthFacadeServices.xml: login#Session, get#SessionInfo, change#ExpiredPassword, and logout#Session. Every other facade service requires a signed-in user. /rpc/json is fenced to Darpan’s own namespaces. RpcMethodFence (src/main/groovy/darpan/facade/common/RpcMethodFence.groovy), wired as a webroot before-request hook in the component MoquiConf.xml, refuses any method that does not start with facade., admin. or gql., checking the top-level method and every batch entry, with an ArtifactAuthorizationException (HTTP 403) before dispatch. That includes stock Moqui services marked allow-remote="true". gql.* stays callable because each moqui-gql remote service gates itself. The same fence closes the framework’s /rest/login transition. /rest/s1/* is not affected.

Facade services

Facade services are the app integration point. The darpan component’s facade files are: Connector components add their own facade files under the same facade.* namespace:

Core reconciliation services

Core reconciliation services live under service/reconciliation/**. Two more internal service files sit beside them:

XML actions first

Service bodies are written as Moqui XML actions by default. XML actions compile to Groovy, so they cost nothing at runtime, and they keep the contract and its orchestration readable in one place. New Groovy whose body is only entity find or CRUD, simple conditions and loops, service calls, field mapping, or message handling is a review finding: write it as XML actions instead. Groovy is the right tool for:
  • Spark dataset work
  • Drools compilation and execution
  • Streaming file I/O
  • HTTP and GraphQL clients
  • Crypto
  • Non-trivial JSON or string processing
Tenant-scoped reads go through TenantScopedFinder. See Data access and tenancy.

Generated API contract

The remote API contract is generated from the service XML, not written by hand. ApiContractGeneratorTests runs the same drift check inside the test suite, so a service change that skips regeneration fails the build. The contract carries a version number that changes only on a breaking change: a removed method, a removed or renamed parameter or output field, or a type change. Additive changes keep the version. When you add or change a remote service:
  1. Define it in the right namespace: facade.* for the app, admin.* for operator-only work.
  2. Regenerate the contract and commit it with the service change.
  3. Refresh the app’s copy of the contract (npm run sync-contract in darpan-ui) when the app calls the new method.

API shape

Darpan APIs are exposed through facade service names and the Moqui JSON-RPC envelope. Service references document required parameters, auth expectations, side effects, and response fields for those facade contracts.