How to call through Java-based services
How to call Pega Platform through Java-based services
Pega Platform provides three Java-based service interfaces (EJB, Java, and JSR94) that you can use to request services using a signature-based or an engine API invocation-based invocation style:
- Signature-based means the external application invokes the Pega Platform service rules through the proxy EJB or Java archive generated by the service package. The proxy publishes the method signatures of the service rules. A client application sends the input to the service rule by calling a method in the proxy — a method with parameters that match the service rule. The proxy manages type validation, constructs the URI for the service rule, and so on.
- Engine API invocation means the external application invokes the Pega Platform service rules through a (generic) business delegate, directly through the PRService EJBs, or through an instance of the PegaRULES engine. The client application calls one Java method no matter which service rule is targeted in the Pega Platform. The parameters provided in the invocation identify the service rule and provide the input for the service rule. Unlike the signature-based style, no compile-time validation of method names and parameters does not occur, because you are not using a proxy compiled by the Pega Platform.
Service EJB rules and Service Java rules support both invocation styles. Service JSR94 rules support the engine API invocation style only, in accord with the JSR 94 specification.
Which service rule type and invocation style is best depends on your situation and needs. For example:
- If the external calling application is an enterprise application, use Service EJB rules with a generated proxy.
- If your organization seeks to comply with the JSR 94 specification, use Service JSR94.
- For a POJO (plain old Java object) interface to the Pega Platform, use Service Java rules, with or without a generated proxy.
For more information, see Building EJB Services and Building JSR-94 Services, two documents available on the Integration area of the Pega Community.