Comment coder une application d’intégrateur de transactions

Une fois que vous avez déployé un composant d’intégrateur de transactions (TI), vous pouvez écrire du code sur ce composant. Une fois que vous avez terminé d’écrire votre code, vous pouvez tester votre code et, si nécessaire, modifier l’interface vers le composant TI.

Pour coder une application TI

  1. Créez un instance de l’objet TI.

    L’objet TI contient les interfaces sur lesquelles vous allez écrire du code. Lorsque votre application appelle une interface sur l’objet TI, TI Manager transmet les informations à votre serveur distant.

  2. Configurez vos variables de données.

    Comme avec de nombreuses applications qui utilisent Host Integration Server, il est important d’utiliser un type de données qui peut traduire correctement vers et à partir de votre serveur distant. Pour plus d’informations sur les types de données et la façon dont ils sont mappés entre les systèmes, consultez Types de données et Données hôtes et Automation.

  3. Effectuez des appels sur tous les paramètres pertinents dans l’objet TI.

    Effectuez toutes les actions nécessaires à votre application, ce qui inclut probablement l’appel des interfaces décrites par votre objet TI. Vous pouvez également avoir des tâches supplémentaires nécessaires pour votre application. Pour plus d’informations, consultez Programmation Windows-Initiated traitement.

  4. Lors de l’écriture de votre application, veillez à prendre en compte les détails de sécurité pertinents de votre environnement.

Exemple

L’exemple suivant est extrait du code du programme main du didacticiel Discriminationd Union dans l’exemple de répertoire sdk. Pour obtenir l’exemple de code complet, consultez <Répertoire> d’installation\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  
    }  
}  

Commentaires facultatifs.

Voir aussi

Comment créer un nouveau serveur d’intégration d’hôte Designer projet