Trigger Services

The generated SDK provides various classes, which allow to easily trigger 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 cc
import de.cards.domain.cc.service.GetCreditCardDetails;

// Declare and Inject class of service GetCreditCardDetails
@Autowired
private GetCreditCardDetails getCreditCardDetails;

// Calling GetCreditCardDetails and passing cardIdentificationEntity as service input entity
CreditCard creditCardEntity = getCreditCardDetails.execute(cardIdentificationEntity);

Namespace Service facade

For each domain 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, CcService is a namespace facade that group all the services of the namespaces where cc is the namespace acronym.

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

// Declare and Inject Service Facade
@Autowired
private CcService ccService;

// Use namespace service facade to call GetCreditCardDetails service within namespace cc

// Calling GetCreditCardDetails and passing cardIdentificationEntity as service input entity
CreditCard creditCardEntity = ccService.getCreditCardDetails(cardIdentificationEntity);

General Domain Service facade

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

// Import DomainService
import de.cards.sdk.domain.facade.DomainService;

// Declare & Inject Domain Service Facade
@Autowired
private DomainService domainService;

// Calling GetCustomerDetails service that belongs to namespace prefixed by cc
Customer customerEntity = domainService.getCc().getCustomerDetails(customerIdentificationEntity);