Trigger REST Integration Services

The generated SDK provides various classes, which allow to easily trigger integration services from other places in the service.

Directly use service class

The simplest way of triggering another service is to directly inject and use the generated service class.

In the example below, it is shown how to inject the service class and execute it using an input entity.

// Importing the service class from namespace cards
import de.cards.integration.cards.service.LoadCardDetails;

// Declare and Inject class of service LoadCardDetails
@Autowired
private LoadCardDetails loadCardDetails;

// Calling LoadCardDetails and passing cardDetailsInputEntiy as service input entity
CardDetails cardDetailsEntity = loadCardDetails.execute(cardDetailsInputEntiy);

Namespace service facade

For each integration namespace, a facade is generated where all the services defined in the namespace are grouped together. The facades can be injected and used as shown in the example below.

In the below example, CardsService is a namespace facade that group all the services of the namespaces where card is the namespace acronym.

// Importing cc namespace service facade that provides access to all of its services.
import de.cards.sdk.integration.cards.facade.CardsService;

// Declare and Inject Service Facades
@Autowired
private CardsService cardsService;

// Use namespace service facade to call LoadCardDetails service within that namespace

// Calling LoadCardDetails and passing cardDetailsInputEntiy as service input entity
CardDetails cardDetailsEntity = cardsService.loadCardDetails(cardDetailsInputEntiy);

General integration service facade

Besides Namespace Service facades, the SDK also provides a Service facade which holds all services in integration namespaces.

// Import IntegrationService
import de.cards.sdk.integration.facade.IntegrationService;

// Declare & Inject Integration Service Facade
@Autowired
private IntegrationService integrationService;

// Calling LoadCardDetails service that belongs to namespace prefixed by cards.
CardDetails cardDetailsEntity = integrationService.getCards().loadCardDetails(cardDetailsInputEntiy);