トランザクション インテグレーター アプリケーションをコーディングする方法

トランザクション インテグレーター (TI) コンポーネントをデプロイしたら、そのコンポーネントに対してコードを記述できます。 コードの記述が完了したら、コードをテストし、必要に応じて TI コンポーネントへのインターフェイスを変更できます。

TI アプリケーションをコーディングするには

  1. TI オブジェクトのインスタンスを作成します。

    TI オブジェクトには、コードを記述するインターフェイスが含まれています。 アプリケーションが TI オブジェクトのインターフェイスを呼び出すと、TI マネージャーは情報をリモート サーバーに渡します。

  2. データ変数を設定します。

    Host Integration Server を使用する多くのアプリケーションと同様に、リモート サーバーとの間で正常に変換できるデータ型を使用することが重要です。 データ型とシステム間のマッピング方法の詳細については、「 データ型 」と「 Host and Automation Data」を参照してください。

  3. TI オブジェクト内の関連するパラメーターに対して呼び出しを行います。

    アプリケーションに必要なアクションを実行します。これには、TI オブジェクトによって記述されたインターフェイスの呼び出しが含まれる可能性があります。 アプリケーションに必要な追加のタスクがある場合もあります。 詳細については、「 プログラミング Windows-Initiated 処理」を参照してください。

  4. アプリケーションを作成するときは、環境の関連するセキュリティの詳細を考慮してください。

次の例は、SDK サンプル ディレクトリの判別共用体チュートリアルのメイン プログラム コードから切り取られています。 完全なコード サンプルについては、「Installation Directory>\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 プロジェクトを作成する方法