서비스 호출
비즈니스 로직에서 서비스 호출이 필요할 때 사용하는 서비스 호출 API를 소개한다.
1. 형식
DefaultServiceExecutor.execute(trxCd, serviceArg); // 동기 방식의 서비스 연동
DefaultServiceExecutor.executeAsync(trxCd, serviceArg, timeout); // 비동기 방식의 서비스 연동
DefaultServiceExecutor.executeAsyncForWait(trxCd, serviceArg, timeout); // 비동기 방식의 서비스 연동22. 설명
- 
execute 동기방식으로 서비스를 연동한다. 호출 거래와 피호출거래의 트랜잭션은 동일한 트랜잭션으로 처리한다. 
- 
executeAsync 비동기방식으로 서비스를 연동한다. 
 피호출거래는 호출거래를 수행하는 쓰레드와 별도의 쓰레드에서 수행되어 피호출거래를 호출한 후 응답객체는 반환하지 않는다.
 호출 거래와 피호출거래의 트랜잭션을 분리하여 피호출거래의 트랜잭션을 새로운 트랜잭션으로 처리한다.
- 
executeAsyncForWait 비동기방식으로 서비스를 연동한다. 
 피호출거래는 호출거래를 수행하는 쓰레드와 별도의 쓰레드에서 수행되어 피호출거래를 호출한 후 응답으로 AsyncResponse객체를 반환한다.
 이후 AsyncResponse객체의 waitForResponse()메소드를 호출하여 피호출거래의 응답객체를 얻을 수 있다.
 호출 거래와 피호출거래의 트랜잭션을 분리하여 피호출거래의 트랜잭션을 새로운 트랜잭션으로 처리한다.
3. 예제
@BxmCategory(logicalName = "Service Execute API Sample")
public SSMP1005A001OutDto callInternalLink(SSMP1005A001InDto input)
        throws DefaultApplicationException {
    logger.debug("============== START ==============");
    logger.debug("input = {}", input);
    SSMP1001A001InDto calleeInput = new SSMP1001A001InDto();
    /**
     * @BXMType LogicalArea
     * @Desc internal service input data mapping
     */
    {
        calleeInput.setFeduEmpNo(input.getFeduEmpNo());
    }
    SSMP1001A001OutDto calleeOutput = null;
    SSMP1005A001OutDto output = new SSMP1005A001OutDto();
    /**
     * @BXMType Try
     */
    try {
        /**
         * @BXMType ServiceExecutorCall
         * @Desc internal service call
         */
        calleeOutput = DefaultServiceExecutor.execute("SSMP1001A001", calleeInput);
    } catch (DefaultApplicationException e) {
        /**
         * @BXMType ApplicationException
         * @Desc throw exception when internal service throw checked exception
         */
        throw new DefaultApplicationException("BXME60008", null, new Object[] {},  e);
    }
    /**
     * @BXMType LogicalArea
     * @Desc output data mapping
     */
    {
        output.setFeduEmpNo(calleeOutput.getFeduEmpNo());
        output.setFeduEmpNm(calleeOutput.getFeduEmpNm());
        output.setFeduOccpNm(calleeOutput.getFeduOccpNm());
        output.setFeduMngrEmpNo(calleeOutput.getFeduMngrEmpNo());
        output.setFeduHireDt(calleeOutput.getFeduHireDt());
        output.setFeduPayAmt(calleeOutput.getFeduPayAmt());
        output.setFeduDeptNo(calleeOutput.getFeduDeptNo());
    }
    logger.debug("output = {}", output);
    logger.debug("============== END ==============");
    return output;
}