다음을 통해 공유


트랜잭션 통합자 애플리케이션을 코딩하는 방법

TI(트랜잭션 통합자) 구성 요소를 배포한 후에는 해당 구성 요소에 대한 코드를 작성할 수 있습니다. 코드 작성이 완료되면 코드를 테스트하고 필요한 경우 인터페이스를 TI 구성 요소로 수정할 수 있습니다.

TI 애플리케이션을 코딩하려면

  1. TI 개체의 instance 만듭니다.

    TI 개체에는 코드를 작성할 인터페이스가 포함되어 있습니다. 애플리케이션이 TI 개체에서 인터페이스를 호출하면 TI 관리자가 원격 서버에 정보를 전달합니다.

  2. 데이터 변수를 설정합니다.

    호스트 통합 서버를 사용하는 많은 애플리케이션과 마찬가지로 원격 서버와 성공적으로 변환할 수 있는 데이터 형식을 사용하는 것이 중요합니다. 데이터 형식 및 시스템 간 매핑 방법에 대한 자세한 내용은 데이터 형식호스트 및 자동화 데이터를 참조하세요.

  3. TI 개체의 관련 매개 변수에 대해 호출합니다.

    TI 개체에서 설명하는 인터페이스 호출을 포함하는 애플리케이션에 필요한 작업을 수행합니다. 애플리케이션에 필요한 추가 작업이 있을 수도 있습니다. 자세한 내용은 프로그래밍 Windows-Initiated 처리를 참조하세요.

  4. 애플리케이션을 작성할 때는 환경의 관련 보안 세부 정보를 고려해야 합니다.

예제

다음 예제는 SDK 샘플 디렉터리의 차별 공용 구조체 자습서에서 기본 프로그램 코드에서 잘라냅니다. 전체 코드 샘플은 설치 디렉터리>\Microsoft Host Integration Server\SDK\Samples\ApplicationIntegration\WindowsInitiated\DiscrimiatedUnion을 참조<하세요.

using System;  
using System.Collections.Generic;  
using System.Text;  
using Banking;  
  
namespace DiscriminatedUnions  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            Console.WriteLine("Processing Output only Account Information");  
            AccountInformationOutOnly();  
  
            Console.WriteLine("\n\nProcessing Input and Output Account Information");  
            AccountInformationInOut();  
  
            Console.WriteLine("\nPress any key to continue...");  
            Console.Read();  
  
        }  
  
        #region Output Only Discriminated Union Processing  
        static void AccountInformationOutOnly()  
        {  
            // Define an instance of the TI Banking object  
            Banking.Accounts MyBankObj = new Banking.Accounts();  
  
            // Call the Get Account Information method on the TI Object  
            // passing it the array that contains the checking and saving   
            // account information   
            string AccountNumber = "BNK4566112";  
            string AccountType = " ";  
            Object AcctInfoUnionObj = null;  
            string FillerNotUsedByThisSample = " ";  
  
            MyBankObj.GetAInfoOutOnly("111223333", AccountNumber, out AccountType, out AcctInfoUnionObj, out FillerNotUsedByThisSample);  
            switch (AcctInfoUnionObj.GetType().ToString())  
            {  
                // check the type of the union that was returned to determine   
                // whether the array element  
                // is a checking or saving account so that the correct  
                // structure of the union can be used  
                case "Banking.CHECKING":  
                        Banking.CHECKING ChkInfo = (Banking.CHECKING)AcctInfoUnionObj;  
  
                        Console.WriteLine("Checking account number: {0}", AccountNumber);  
                        Console.WriteLine("\tOverdraft charge:\t {0,10:C2}", ChkInfo.CHK_OD_CHG);  
                        Console.WriteLine("\tOverdraft limit:\t {0,10:C2}", ChkInfo.CHK_OD_LIMIT);  
                        Console.WriteLine("\tLinked account:\t {0,18}", ChkInfo.CHK_OD_LINK_ACCT);  
                        Console.WriteLine("\tLast Statement:\t {0,18}", ChkInfo.CHK_LAST_STMT);  
                        Console.WriteLine("\tDetail Items:\t {0,18:F0}", ChkInfo.CHK_DETAIL_ITEMS);  
                        Console.WriteLine("\tBalance:\t {0,18:C2}\n", ChkInfo.CHK_BAL);  
                    break;  
  
                case "Banking.SAVINGS":  
                        Banking.SAVINGS SavInfo = (Banking.SAVINGS)AcctInfoUnionObj;  
  
                        Console.WriteLine("Savings account number: {0}", AccountNumber);  
                        Console.WriteLine("\tInterest rate:\t {0,20:P}", SavInfo.SAV_INT_RATE / 100);  
                        Console.WriteLine("\tService charge:\t {0,18:C2}", SavInfo.SAV_SVC_CHRG);  
                        Console.WriteLine("\tLast Statement:\t {0,18}", SavInfo.SAV_LAST_STMT);  
                        Console.WriteLine("\tDetail Items:\t {0,18:F0}", SavInfo.SAV_DETAIL_ITEMS);  
                        Console.WriteLine("\tBalance:\t {0,18:C2}\n", SavInfo.SAV_BAL);  
                    break;  
  
                default:  
                    break;  
            }  
        }  
        #endregion Output Only Discriminated Union Processing  
    }  
}  

선택적 설명입니다.

참고 항목

새 호스트 통합 서버 Designer 프로젝트를 만드는 방법