Start Today

← Documentation

RPC entity

Introduction

RPC entities are Plain Java Objects used as models for Mainframe and IBM i RPC programs, SOAP services, stored procedures, and similar backends.

Structure

The RPC entity comprises three main parts: RPC Field, RPC Part, and an enclosing RPC Entity.

  • RPC Field — an ordinary Java field annotated with @RpcField. It represents a field of the backend program.
  • RPC Part — a Java class or static nested class annotated with @RpcPart, representing a structured object. A part defined as a separate class is an external RPC Part. Nested parts are not limited to a specific number of layers.
  • RPC Entity — the enclosing representation of a single backend program (input, output, and metadata) executed by the SDK project.

Behavior can be defined by properties such as @RpcActions, @Action, and @RpcNavigation.

@RpcEntity(name="Books", language=Languages.COBOL)
@RpcActions(actions = {
        @Action(action = EXECUTE.class, path = "BOOKS")})
public class Items {

    @RpcField(originalName = "BOOK")
    private Book bookPart;
    
    @RpcPart(name = "InnerRecord", originalName = "INNER-RECORD", displayName = "INNERRECORD")
    public static class Book {

        @RpcField(length = 16, originalName = "TITLE", legacyType = "Char")
        private String title;
    
        @RpcField(length=20, originalName ="AUTHOR", legacyType = "Char")
        private String author;

        @RpcNumericField(minimumValue = -9999, maximumValue = 9999, decimalPlaces = 0)    
        @RpcField(length = 2, originalName = "ISBN", legacyType = "Binary Integer")
        private Integer isbn;

        @RpcField(length = 28, originalName = "DESCRIPTION", legacyType = "Char")
        private String description;
    }
}

RPC properties

@RpcEntity, @RpcField, and @RpcPart are structural. When a class is annotated with @RpcEntity, @RpcPart, @RpcEntitySuperClass, or @RpcPartSuperClass, compilation also generates getters/setters, an actions list, and auxiliary JSON/XML annotations.

Runtime behavior is controlled with @RpcActions / @Action, RPC field properties (except @Hidden), and the Direction enum.

RPC entity propertiesRPC field propertiesRPC part properties
@RpcEntity@RpcField@RpcPart
@RpcEntitySuperClass@RpcBooleanField@RpcPartSuperClass
@RpcNavigation@RpcDateField
@RpcActions@RpcNumericField
@Action@RpcList
Languages enum@RpcDynamicField
@Hidden
Direction enum

Actions

@RpcActions contains @Action entries:

  • action (mandatory) — READ, EXECUTE, UPDATE, DELETE, GET, POST, SHOW, …
  • path — executable program / procedure / REST API on the host
  • alias, displayName
  • olCache / olCacheEvict — per-action cache

RPC field properties

Each field should be annotated with @RpcField. Main attributes:

  • length — bytes in the buffer
  • originalName — host field name
  • legacyType — host type (platform-specific)
  • order — serialization order override
  • direction — INPUT, OUTPUT, INPUT_OUTPUT (default), ERROR, NONE

Companion annotations: @RpcBooleanField, @RpcDateField, @RpcNumericField, @RpcList (count 0 = dynamic list), @FieldAttribute.

Additional

  • @RpcNavigation — category name for web solutions
  • @Hidden — hide the field in the view

See RPC projects and RPC SDK.


Source: RPC Entity (Confluence)

Java model for an RPC program: @RpcEntity, @RpcField, @RpcPart, actions, and field direction.

Read more