BEA Logo BEA eLink Adapter for Portal Infranet Release 1.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   eLink Adapter for Portal Infranet Doc Home   |   eLink Adapter for Portal Infranet User Guide   |   Previous Topic   |   Next Topic   |   Contents   |  

Running the Sample Application

 

The information in this section is designed to help you start and run a sample application. This section contains the following information:

 


Step 1: Copy the simpportal Files

Perform two primary tasks to copy the simpportal files:

Step 1.1: Make a Directory for simpportal

Make a directory for the simpportal and cd to it so you can see clearly the simpportal files you have at the start and the additional files you create along the way. Use the standard shell (/bin/sh) or the Korn shell, not csh.

To make a directory, type the following:

mkdir simpportal
cd simpportal

Step 1.2: Copy the simpportal Files

Later in the process you will edit some of the files and make them executable, so it is best to begin with a copy of the files rather than the originals delivered with the software. The directory shown in Listing 5-1 contains sample files for configuring the eLink Adapter for Portal Infranet. To copy the simpportal files, type the following:

cp $TUXDIR/elink/portal/simpportal ./

Listing 5-1 Description of Sample Files

File Name

Description

elinkportal.ubb

sample eLink Platform ubbconfig file

elinkportal.env

sample eLink Platform ENVFILE for eLink for Portal Infranet adapter

elinkportal.cfg

sample eLink for Portal Infranet adapter configuration file

pin.conf (Unix) or pin.cnf (NT)

sample Portal Infranet configuration file

setenv.sh

sample UNIX Korn Shell script to set environment

create_cust.c

sample eLink Platform client application

prtconst.h

header file that defines constants for Portal Infranet data

setenv.bat

sample NT script to set the environment


 


Step 2: Set Up Environment Files

The information in this section is designed to help you perform the following two setup tasks on both platforms:

Step 2.1A Set and Export Environment Variables for the Unix Platform

For the Unix platform to set and export the environment variables, edit the setenv.sh file. You need the TUXDIR and PATH to access files in the eLink Platform System/T directory structure and execute eLink Platform System/T commands. With HPUX on the HP9000, use SHLIB_PATH instead of LD_LIBRARY_PATH. Listing 5-2 shows a sample of the environment variables for the Unix platform.

Note: You must set up the TUXCONFIG to be able to load the configuration file.

To set and export the environment variables for a Unix platform, edit the provided file setenv.sh. Using a standard text editor, follow these steps:

  1. Bring up setenv.sh in your text editor.

  2. Replace the fields delimited with `<' and `>' signs.

  3. Set the shared library path for Unix:
    SHLIB_PATH=$(TUXDIR)/lib:$(SHLIB_PATH)

  4. Set the environment by executing this script:
    . . /setenv.sh

    Listing 5-2 Sample Environment Variables File for the Unix Platform


    #!/bin/sh
    APPDIR=<your eLink app directory>
    export APPDIR
    TUXDIR=<your TUXEDO install directory>
    export TUXDIR
    PINDIR=<your Portal Infranet install directory>
    export PINDIR
    TUXCONFIG=${APPDIR}/tuxconfig
    export TUXCONFIG
    BDMCONFIG=${APPDIR}/bdmconfig
    export BDMCONFIG
    FIELDTBLS32=elinkportal.fml,Usysfl32
    export FIELDTBLS32
    FLDTBLDIR32=${APPDIR}:${TUXDIR}/udataobj
    export FLDTBLDIR32
    PATH=${TUXDIR}/bin:${PATH}
    # ---------------------------------------------
    # Set shared library path according to platform
    # ---------------------------------------------
    #
    # For HP-UX use SHLIB_PATH
    #
    #SHLIB_PATH=${TUXDIR}/lib:${PINDIR}/lib:${SHLIB_PATH}
    #export SHLIB_PATH
    #
    # For Solaris use LD_LIBRARY_PATH
    #
    #LD_LIBRARY_PATH=${TUXDIR}/lib:${PINDIR}/lib:${LD_LIBRARY_PATH}
    #export LD_LIBRARY_PATH
    #
    # For AIX use LIBPATH
    #
    #LIBPATH=${TUXDIR}/lib:${PINDIR}/lib:${LIBPATH}
    #export LIBPATH


    Note: PINDIR should point to the directory where Portal Infranet is installed.

Step 2.1B Set and Export Environment Variables for the NT Platform

To set and export the environment variables, you must edit the setenv.bat file if you are using a NT 4.0 platform. You need the TUXDIR and PATH to access files in the eLink Platform System/T directory structure and execute eLink Platform System/T commands. Listing 5-3 shows a sample of the environment variables for the NT 4.0 platform.

Note: You must set up the TUXCONFIG to be able to load the configuration file.

To set and export the environment variables for a NT platform, edit the provided file setenv.bat. Using a standard text editor, follow these steps:

  1. Bring up setenv.bat in your text editor.

  2. Replace the fields delimited with `<' and `>' signs.

  3. Set the environment by executing this script:

    setenv 

    Listing 5-3 Sample Environment Variables File for the NT Platform


    set APPDIR=<Your eLink app directory>
    set TUXDIR=<Your TUXEDO install directory>
    set PINDIR=<Your Portal Infranet install directory>
    set TUXCONFIG=%APPDIR%\tuxconfig
    set BDMCONFIG=%APPDIR%\bdmconfig
    set FIELDTBLS32=elinkportal.fml,Usysfl32
    set FLDTBLDIR32=%APPDIR%;%TUXDIR%\udataobj
    set PATH=%TUXDIR%\lib;%PINDIR%\bin;%PATH%
    set LIB=%TUXDIR%\lib;%PINDIR%\lib;%LIB%


    Note: PINDIR should point to the directory where Portal Infranet is installed.

Step 2.2 Edit the Adapter Environment File

You must edit the adapter environment file to allow the adapter to access system and user-defined FML field tables. Table 5-1 provides a description of the two environment variables to access FML tables. Listing 5-4 shows a sample adapter environment file for the Unix platform, and Listing 5-5 shows the file for an NT platform.

Using a standard text editor, follow these steps:

  1. Access the environment file elinkportal.env.

  2. Replace the fields delimited with `<' and `>' signs.

    Table 5-1 Environment Variables to Access FML Tables

    Variable Name

    Description

    FIELDTBLS32

    Lists the FML field tables that are to be access by the eLink Adapter for Portal Infranet.

    FLDTBLDIR32

    Lists the directories to be searched for these FML field tables.

    Listing 5-4 Sample Adapter Environment File for a Unix Platform


    FIELDTBLS32=Usysfl32,elinkportal.fml

    FLDTBLDIR32=<your eLink app directory>:<your TUXEDO install directory>/udataobj


    Listing 5-5 Sample Adapter Environment File for an NT Platform


    FIELDTBLS32=Usysfl32,elinkportal.fml

    FLDTBLDIR32=<your eLink app directory>;<your TUXEDO install directory>/udataobj


 


Step 3: Edit the eLink Platform Configuration File

To define the ELINKPORTALO server, add the ELINKPORTALO information in the SERVERS section of the UBBCONFIG file. The following parameters are required for defining the ELINKPORTALO server. Listing 5-6 shows the parameters for defining the server.

Listing 5-6 Parameters for Defining the ELINKPORTALO Server


*SERVERS

ELINKPORTALO
SRVGRP=groupname SRVID=n
CLOPT="-- -C elinkportal.cfg"

For information about the SRVGRP, SRVID, and CLOPT parameter syntax and definitions, refer to the BEA TUXEDO Reference Manual.

CLOPT= "-- -C configfile"

specifies the adapter's configuration file.


Listing 5-7 shows a sample configuration file.

Listing 5-7 Sample Configuration File


#################################################################
# This is a skeletal TUXEDO configuration file - "ePS.ubb" designed
# to be used for BEA eLink Adapter for ELINKPORTALO.ubb
#
################################################################## @(#)$Header: /repos/port/sample/simpportal/elinkportal.ubb,v 1.1 1999/10/04 22:27:18 schupbac Exp $
# Copyright )1999, BEA Systems, Inc., all rights reserved.

*RESOURCES
IPCKEY 33248 # ( 32768 < IPCKEY < 262143 )
MASTER eLink
DOMAINID eLink
MODEL SHM
MAXSERVERS 20
SECURITY NONE
#SECURITY USER_AUTH

*MACHINES
"<uname>" LMID="eLink"
TUXDIR="<your TUXEDO install directory>"
APPDIR="<your eLink app directory>"
TUXCONFIG="<your eLink app directory>/tuxconfig"
ENVFILE="<your eLink app directory>/elinkportal.env"
TYPE="HP-UX"
MAXACCESSERS=80

*GROUPS
EPORTALGRP LMID=eLink

GRPNO=1


# ----------------------------------------------------------------------

*SERVERS

DEFAULT:
CLOPT="-A" # Advertise all services.
REPLYQ=N # Reply queue not needed for our simple setup.
MAXGEN=3 # Max number of restarts in the grace period.
GRACE=60 # Ten minutes grace period.
RESTART=Y
SYSTEM_ACCESS=FASTPATH

ELINKPORTALO
SRVGRP=EPORTALGRP
SRVID=200
CLOPT="-A -- -C elinkportal.cfg"

*SERVICES


 


Step 4: Load the eLink Platform Configuration File

Perform two primary tasks to load the eLink Platform configuration file:

Step 4.1: Load the File

Run tmloadcf to load the configuration file.

$ tmloadcf elinkportal.ubb
Initialize TUXCONFIG file: /usr/me/simpportal/tuxconfig [y, q] ? y
$

Step 4.2: Check the Results

Check to ensure that a file called tuxconfig is a new file under the control of eLink Platform System/T. Listing 5-8 shows a sample eLink Platform configuration file.

Listing 5-8 Sample eLink Platform Configuration File


$ ls -l tuxconfig
total 216
-rw-r----- 1 userid grpid 106496 May 29 09:26 tuxconfig


 


Step 5: Modify Portal Infranet Configuration File (pin.conf or pin.cnf)

The eLink Adapter for Portal Infranet uses Portal Infranet libraries to connect to the Portal Infranet system. The file pin.conf (Unix) pin.cnf (NT) is a configuration file that Portal Infranet libraries use to find the Portal Infranet system. This file must be installed in the application directory of the eLink Adapter for Portal Infranet. The following entries must be modified in the sample pin.conf (or pin.cnf) file that is supplied with the adapter

Examine the sample Portal Infranet configuration file shown in Listing 3-4 in Configuring the eLink Adapter for Portal Infranet,of this manual. This configuration connects the adapter to a Portal Infranet system on node mynode port 11960 using a login of 'root' and a password of 'password'.

 


Step 6: Boot the Application

Executing tmboot brings up the adapter. Listing 5-9 shows a sample boot process. To execute tmboot, type the following:

tmboot -y.

Listing 5-9 Sample Boot Process


INFO: TUXEDO(r) System Release 6.5 
INFO: Serial #: 1000039580, Expiration 2000-02-16, Maxusers 10000
INFO: Licensed to: FOO SYSTEMS

Booting admin processes ...

exec BBL -A :
process id=20993 ... Started.

Booting server processes ...

exec ELINKPORTALO -A -- -C elinkportal.cfg :
process id=20994 ... Started.
2 processes started.


BBL is the administrative process that monitors the application shared memory structures. The server (ELINKPORTALO) runs continuously awaiting requests.

 


Step 7: Create a Customer Account

Included with the eLink Adapter for Portal Infranet is a sample eLink Platform client program. This supplied client create_cust.c creates a customer named John W. Doe within the Portal Infranet system. This client takes the service name as a parameter and creates the customer John W. Doe from hard-coded test data. The client creates an FML32 request buffer containing the hierarchical data for the new customer John W. Doe. This buffer is then sent to the Portal Infranet adapter service, and the response is returned. The FML32 response buffer is printed to standard out using the FML function Fprint32().

Step 7.1 Examine the Sample Client Program

Before you build the sample client program, examine the program for several important considerations. Table 5-2 provides a key to some important information for you to consider as you examine the sample client program. Listing 5-10 shows the source code for the sample client program. Use the following steps to access the source code:

  1. Access the source code by typing: $ more create_cust.c

  2. Page through the client program and look for the following information:

    Table 5-2 Sample Client Program Information Key

    Line Number

    Significant Information

    39-250

    Hierarchical data and structures are declared for the John W. Doe customer.

    283

    The Portal Infranet adapter service is the first command line parameter.

    311

    add_account_info() is called to populate the FML32 request buffer with hierarchical data for the new customer John W. Doe.

    322

    Portal Infranet adapter service is invoked.

    371

    add_account_info() adds the FML32 field ACCOUNT_INFO_OCC to explicitly indicate how many occurrences of account info exist in this buffer.

    379-386

    For each account that is to be added, information is added to the FML32 buffer that describes what services this account is subscribing too, billing information for this account, etc. A function is used to add each group of data. The CREATE_CUST interface is also documented in the The CREATE ACCOUNT section of Appendix A, "Portal Infranet Service Interfaces" in this manual.

    399, 420, 448, 468, 520, 555, 613, 636, 655, 675

    Each function that adds a group of data to the FML32 buffer, adds an `occurrence' field to indicate how many times this group occurs in the buffer.

    Listing 5-10 Source code for the Sample Client Program


    1 /*	Copyright 1999 BEA Systems, Inc.	*/
    2 /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
    3 /* BEA Systems, Inc. */
    4 /* The copyright notice above does not evidence any */
    5 /* actual or intended publication of such source code. */
    6
    7
    8 /*****************************************************/
    9 /* test case 1 create_cust.c */
    10 /*****************************************************/
    11
    12
    13 #include <stdio.h>
    14 #include <string.h>
    15
    16 #include "atmi.h"
    17 #include "fml32.h"
    18 #include "prtconst.h"
    19
    20 /* Define constants for creating FML buffer */
    21 #define NF 256
    22 #define DATALEN 32000
    23
    24 /*---------------------*/
    25 /* Sample data Section */
    26 /*---------------------*/
    27 #define NUM_ACCOUNT_INFO 1
    28 #define NUM_SERVICES 1
    29 #define NUM_BILLINFO 1
    30 #define NUM_ACTGINFO 1
    31 #define NUM_PAYINFO 1
    32 #define NUM_INVINFO 1
    33 #define NUM_CCINFO 1
    34 #define NUM_NAMEINFO 1
    35 #define NUM_EXEMPTIONS 1
    36 #define NUM_LOCALES 1
    37 #define NUM_PHONESINFO 1
    38
    39 char sample_plan_name[] = "Standard";
    40
    41 /* Accounting information structure */
    42 struct actginfo
    43 {
    44 long actg_future_dom;
    45 long actg_type;
    46 };
    47
    48 struct actginfo sample_actginfo =
    49 {
    50 18,
    51 EPA_ACTG_TYPE_BALANCE_FORWARD
    52 };
    53
    54 /* Structure for services FIELD_GROUP */
    55 struct services
    56 {
    57 char deal_name[BUFSIZ];
    58 char service_type[BUFSIZ];
    59 char login[BUFSIZ];
    60 char passwd_clear[BUFSIZ];
    61 };
    62
    63 struct services sample_services =
    64 {
    65 "IP Basic", /* should be present valid deal name in portal */
    66 "/service/email", /* service already available with portal */
    67 "jdoe", /* Unique login should not be present in portal database */
    68 "record"
    69 };
    70
    71 /* billinfo FIELD_GROUP structure */
    72 struct billinfo
    73 {
    74 char merchant[BUFSIZ];
    75 char bill_mode[BUFSIZ];
    76 long bill_type;
    77 long currency;
    78 long bill_when;
    79 char access_code1[BUFSIZ];
    80 char access_code2[BUFSIZ];
    81 };
    82
    83 struct billinfo sample_billinfo =
    84 {
    85 "Microsoft",
    86 "Email",
    87 EPA_BILL_TYPE_CC,
    88 EPA_CURRENCY_USD,
    89 EPA_MMC_TYPE_MONTHLY,
    90 "Access Code1",
    91 "Access Code2"
    92 };
    93
    94 /* payinfo FIELD_GROUP structure */
    95 struct payinfo
    96 {
    97 char name[BUFSIZ];
    98 char obj_type[BUFSIZ];
    99 };
    100
    101 struct payinfo sample_payinfo =
    102 {
    103 "Payment information",
    104 "PAY obj type"
    105 };
    106
    107 /* Invoice info FIELD_GROUP structure */
    108 struct invinfo
    109 {
    110 char name[BUFSIZ];
    111 char address[BUFSIZ];
    112 char city[BUFSIZ];
    113 char state[BUFSIZ];
    114 char zip[BUFSIZ];
    115 char country[BUFSIZ];
    116 char email_addr[BUFSIZ];
    117 long delivery_prefer;
    118 char delivery_descr[BUFSIZ];
    119 long inv_terms;
    120 char inv_instr[BUFSIZ];
    121 long po_type;
    122 long po_options;
    123 double po_amount;
    124 double po_bal_threshold;
    125 char po_exp[BUFSIZ];
    126 char po_exp_threshold[BUFSIZ];
    127 char po_order_no[BUFSIZ];
    128 char po_terms[BUFSIZ];
    129 };
    130
    131 struct invinfo sample_invinfo =
    132 {
    133 "John W. Doe",
    134 "123 Park Dr",
    135 "Cupertino",
    136 "CA",
    137 "95014",
    138 "USA",
    139 "jdoe@beasys.com",
    140 EPA_INV_USP_DELIVERY,
    141 "Delivery descr on invoice",
    142 EPA_INV_TERMS_UNDEFINED,
    143 "Invoice instructions on invoice",
    144 EPA_PO_TYPE_NONE,
    145 EPA_PO_OPTION_CONTINUE,
    146 1111.23,
    147 1.23
    148
    149 };
    150
    151 /* Credit card info FIELD_GROUP strucure */
    152 struct ccinfo
    153 {
    154 char name[BUFSIZ];
    155 char address[BUFSIZ];
    156 char city[BUFSIZ];
    157 char state[BUFSIZ];
    158 char zip[BUFSIZ];
    159 char country[BUFSIZ];
    160 char debit_num[BUFSIZ];
    161 char debit_exp[BUFSIZ];
    162 };
    163
    164 struct ccinfo sample_ccinfo =
    165 {
    166 "John W. Doe",
    167 "123 Main St",
    168 "Cupertino",
    169 "CA",
    170 "95014",
    171 "USA",
    172 "4444111122223333",
    173 "1201"
    174
    175 };
    176
    177
    178 /* locales FIELD_GROUP structure */
    179 struct locales
    180 {
    181 char locale[BUFSIZ];
    182
    183 };
    184
    185 struct locales sample_locales =
    186 {
    187 "English (united kingdom) :ENG"
    188 };
    189
    190 /* Phones FIELD_GROUP structure */
    191 struct phones
    192 {
    193 long type;
    194 char phone[BUFSIZ];
    195 };
    196
    197 struct phones sample_phones =
    198 {
    199 EPA_PHONE_TYPE_WORK,
    200 "972-555-7130"
    201 };
    202
    203 struct exemptions
    204 {
    205 long type;
    206 double percent;
    207 };
    208
    209 struct exemptions sample_exemptions =
    210 {
    211 EPA_RATE_TAX_JUR_COUNTY,
    212 8.25
    213 };
    214
    215 struct nameinfo
    216 {
    217 char contacttype[BUFSIZ];
    218 char salutation[BUFSIZ];
    219 char lastname[BUFSIZ];
    220 char firstname[BUFSIZ];
    221 char middlename[BUFSIZ];
    222 char title[BUFSIZ];
    223 char company[BUFSIZ];
    224 char address[BUFSIZ];
    225 char city[BUFSIZ];
    226 char state[BUFSIZ];
    227 char zip[BUFSIZ];
    228 char country[BUFSIZ];
    229 char email_addr[BUFSIZ];
    230 long element_id;
    231
    232 };
    233
    234 struct nameinfo sample_nameinfo =
    235 {
    236 "Residence",
    237 "Mr.",
    238 "John",
    239 "Doe",
    240 "W",
    241 "software engineer",
    242 "BEA Systems",
    243 "123 Main St.",
    244 "Cupertino",
    245 "CA",
    246 "95014",
    247 "USA",
    248 "jdoe@beasys.com",
    249 1
    250 };
    251
    252 /*-------------------------*/
    253 /* End Sample data Section */
    254 /*-------------------------*/
    255
    256 void add_fld(FBFR32* fbfr, char* fldid, void* value, FLDLEN32 len);
    257 void add_account_info(FBFR32 *fbfr, int num_accounts);
    258 void add_services(FBFR32 *fbfr, int num_services);
    259 void add_billinfo(FBFR32 *fbfr, int num_billinfos);
    260 void add_payinfo(FBFR32 *fbfr, int num_payinfos);
    261 void add_invinfo(FBFR32 *fbfr, int num_invinfos);
    262 void add_ccinfo(FBFR32 *fbfr, int num_ccinfos);
    263 void add_nameinfo(FBFR32 *fbfr, int num_nameinfos);
    264 void add_phonesinfo(FBFR32 *fbfr, int num_phonesinfos);
    265 void add_exemptions(FBFR32 *fbfr, int num_exemptions);
    266 void add_actginfo(FBFR32 *fbfr, int num_actginfo);
    267 void add_locales(FBFR32 *fbfr, int num_locales);
    268
    269 int main(int argc, char *argv[])
    270 {
    271 FBFR32 *fbfr; /* data to be sent */
    272 FLDLEN32 fbfr_len;
    273 FLDID32 field_id;
    274 char *service;
    275 char *response;
    276 int ret;
    277
    278 if (argc != 2)
    279 {
    280 (void) fprintf(stderr, "Usage: create_cust SERVICE");
    281 exit(1);
    282 }
    283 service=argv[1];
    284
    285 /* join the application */
    286 if (tpinit(NULL) == -1)
    287 {
    288 (void) fprintf(stderr,"failed to join application: %s\n",
    289 tpstrerror(tperrno));
    290 exit(1);
    291 }
    292
    293 /*-----------------------------*/
    294 /* Create FML32 request buffer */
    295 /*-----------------------------*/
    296
    297 /* get request buffer */
    298 if ((fbfr = (FBFR32 *) tpalloc("FML32",NULL,Fneeded32(NF,DATALEN)))== (FBFR32 *) NULL)
    299 {
    300 (void) fprintf(stderr,"unable to allocate buffer: %s",
    301 tpstrerror(tperrno));
    302 exit(1);
    303 }
    304
    305 fbfr_len = (int) Fsizeof32(fbfr);
    306 Finit32(fbfr, (FLDLEN32) fbfr_len);
    307
    308 /*-------------------------------------------*/
    309 /* Build create account FML32 request buffer */
    310 /*-------------------------------------------*/
    311 add_account_info(fbfr, NUM_ACCOUNT_INFO);
    312
    313 /*---------------------------*/
    314 /* Dump FML32 request buffer */
    315 /*---------------------------*/
    316 printf("Before:\n\n");
    317 Fprint32(fbfr);
    318
    319 /*--------------*/
    320 /* Call service */
    321 /*--------------*/
    322 ret = tpcall(service, (char *)fbfr, 0, (char **)&fbfr, (long *) &fbfr_len, (long)0);
    323 /*
    324 if(ret == -1)
    325 {
    326 (void) fprintf(stderr, "Can't send request to service %s\n", service);
    327 (void) fprintf(stderr, "Tperrno = %d\n", tperrno);
    328 tpfree((char *) fbfr);
    329 tpterm();
    330 exit(1);
    331 }
    332 */
    333
    334 /*----------------------------*/
    335 /* Dump FML32 response buffer */
    336 /*----------------------------*/
    337 printf("After:\n\n");
    338 Fprint32(fbfr);
    339
    340
    341 /*-------------------*/
    342 /* Clean up and exit */
    343 /*-------------------*/
    344 tpfree((char *)fbfr);
    345
    346 (void) tpterm();
    347
    348 return(0);
    349 }
    350
    351
    352 void add_fld(FBFR32* fbfr, char* fldid, void* value, FLDLEN32 len)
    353 {
    354 FLDID32 fieldid;
    355
    356 fieldid = Fldid32(fldid);
    357 if (Fadd32(fbfr, fieldid, (char*)value, len) < 0)
    358 {
    359 char msg[25];
    360 sprintf(msg, "Fadd32 %s failed: ", fldid);
    361 F_error32(msg);
    362 }
    363 }
    364
    365 void add_account_info(FBFR32 *fbfr, int num_accounts)
    366 {
    367
    368 char temp_string[BUFSIZ];
    369 int i;
    370
    371 add_fld(fbfr, "ACCOUNT_INFO_OCC", (char *) &num_accounts,
    372 (FLDLEN32) sizeof(num_accounts));
    373
    374 for (i=0; i < num_accounts; i++)
    375 {
    376
    377 add_fld(fbfr, "NAME", sample_plan_name, (FLDLEN32)sizeof(sample_plan_name));
    378
    379 add_services(fbfr, NUM_SERVICES);
    380 add_billinfo(fbfr, NUM_BILLINFO);
    381 add_actginfo(fbfr, NUM_ACTGINFO);
    382 add_payinfo(fbfr, NUM_PAYINFO);
    383 add_nameinfo(fbfr, NUM_NAMEINFO);
    384 add_phonesinfo(fbfr, NUM_PHONESINFO);
    385 add_exemptions(fbfr, NUM_EXEMPTIONS);
    386 add_locales(fbfr, NUM_LOCALES);
    387
    388 }
    389
    390 }
    391
    392
    393 void add_services(FBFR32 *fbfr, int num_services)
    394 {
    395
    396 char temp_string[BUFSIZ];
    397 int i;
    398
    399 add_fld(fbfr, "SERVICES_INFO_OCC", (char *) &num_services, (FLDLEN32) sizeof(num_services));
    400
    401 for (i=0; i < num_services; i++)
    402 {
    403
    404 add_fld(fbfr, "DEAL_NAME", sample_services.deal_name, (FLDLEN32) sizeof(sample_services.deal_name));
    405
    406
    407 add_fld(fbfr, "SERVICE_TYPE", sample_services.service_type, (FLDLEN32)sizeof(sample_services.service_type));
    408
    409 add_fld(fbfr, "LOGIN", sample_services.login, (FLDLEN32) sizeof(sample_services.login));
    410
    411 add_fld(fbfr, "PASSWD_CLEAR", sample_services.passwd_clear, (FLDLEN32) sizeof(sample_services.passwd_clear));
    412
    413 }
    414 }
    415 void add_billinfo(FBFR32 *fbfr, int num_billinfos)
    416 {
    417 char temp_string[BUFSIZ];
    418 int i;
    419
    420 add_fld(fbfr, "BILLINFO_INFO_OCC", (char *) &num_billinfos, (FLDLEN32) sizeof(num_billinfos));
    421
    422 for (i=0; i < num_billinfos; i++)
    423 {
    424
    425 add_fld(fbfr, "MERCHANT", sample_billinfo.merchant, (FLDLEN32) sizeof(sample_billinfo.merchant));
    426
    427 sprintf(temp_string, sample_billinfo.bill_mode);
    428 add_fld(fbfr, "BILL_MODE", temp_string, (FLDLEN32) strlen(temp_string));
    429
    430 add_fld(fbfr, "BILL_TYPE", &sample_billinfo.bill_type, (FLDLEN32) sizeof(sample_billinfo.bill_type));
    431
    432 add_fld(fbfr, "CURRENCY", &sample_billinfo.currency, (FLDLEN32) sizeof(sample_billinfo.currency));
    433
    434 add_fld(fbfr, "BILL_WHEN", &sample_billinfo.bill_when, (FLDLEN32) sizeof(sample_billinfo.bill_when));
    435
    436 sprintf(temp_string, sample_billinfo.access_code1);
    437 add_fld(fbfr, "ACCESS_CODE1", temp_string, (FLDLEN32) strlen(temp_string));
    438
    439 sprintf(temp_string, sample_billinfo.access_code2);
    440 add_fld(fbfr, "ACCESS_CODE2", temp_string, (FLDLEN32) strlen(temp_string));
    441 }
    442 }
    443 void add_payinfo(FBFR32 *fbfr, int num_payinfos)
    444 {
    445 char temp_string[BUFSIZ];
    446 int i;
    447
    448 add_fld(fbfr, "PAYINFO_INFO_OCC", (char *) &num_payinfos, (FLDLEN32) sizeof(num_payinfos));
    449
    450 for (i=0; i < num_payinfos; i++)
    451 {
    452 sprintf(temp_string, sample_payinfo.name);
    453 add_fld(fbfr, "NAME", temp_string, (FLDLEN32) strlen(temp_string));
    454
    455 sprintf(temp_string, sample_payinfo.obj_type);
    456 add_fld(fbfr, "OBJ_TYPE", temp_string, (FLDLEN32) strlen(temp_string));
    457
    458 // add_invinfo(fbfr, NUM_INVINFO);
    459 add_ccinfo(fbfr, NUM_CCINFO);
    460
    461 }
    462 }
    463 void add_invinfo(FBFR32 *fbfr, int num_invinfos)
    464 {
    465 char temp_string[BUFSIZ];
    466 int i;
    467
    468 add_fld(fbfr, "INV_INFO_OCC", (char *) &num_invinfos, (FLDLEN32) sizeof(num_invinfos));
    469
    470 for (i=0; i < num_invinfos; i++)
    471 {
    472 sprintf(temp_string, sample_invinfo.name);
    473 add_fld(fbfr, "NAME", temp_string, (FLDLEN32) strlen(temp_string));
    474
    475 sprintf(temp_string, sample_invinfo.address);
    476 add_fld(fbfr, "ADDRESS", temp_string, (FLDLEN32) strlen(temp_string));
    477
    478 sprintf(temp_string, sample_invinfo.city);
    479 add_fld(fbfr, "CITY", temp_string, (FLDLEN32) strlen(temp_string));
    480
    481 sprintf(temp_string, sample_invinfo.state);
    482 add_fld(fbfr, "STATE", temp_string, (FLDLEN32) strlen(temp_string));
    483
    484 sprintf(temp_string, sample_invinfo.zip);
    485 add_fld(fbfr, "ZIP", temp_string, (FLDLEN32) strlen(temp_string));
    486
    487 sprintf(temp_string, sample_invinfo.country);
    488 add_fld(fbfr, "COUNTRY", temp_string, (FLDLEN32) strlen(temp_string));
    489
    490 sprintf(temp_string, sample_invinfo.email_addr);
    491 add_fld(fbfr, "EMAIL_ADDR", temp_string, (FLDLEN32) strlen(temp_string));
    492
    493 add_fld(fbfr, "DELIVERY_PREFER", &sample_invinfo.delivery_prefer, (FLDLEN32) sizeof(sample_invinfo.delivery_prefer));
    494
    495 sprintf(temp_string, sample_invinfo.delivery_descr);
    496 add_fld(fbfr, "DELIVERY_DESCR", temp_string, (FLDLEN32) strlen(temp_string));
    497
    498 add_fld(fbfr, "INV_TERMS", &sample_invinfo.inv_terms, (FLDLEN32) sizeof(sample_invinfo.inv_terms));
    499
    500 sprintf(temp_string, sample_invinfo.inv_instr);
    501 add_fld(fbfr, "INV_INSTR", temp_string, (FLDLEN32) strlen(temp_string));
    502
    503 add_fld(fbfr, "PO_TYPE", &sample_invinfo.po_type, (FLDLEN32) sizeof(sample_invinfo.po_type));
    504
    505 add_fld(fbfr, "PO_OPTIONS", &sample_invinfo.po_options, (FLDLEN32) sizeof(sample_invinfo.po_options));
    506
    507 add_fld(fbfr, "PO_AMOUNT", &sample_invinfo.po_amount, (FLDLEN32) sizeof(sample_invinfo.po_amount));
    508
    509 add_fld(fbfr, "PO_BAL_THRESHOLD", &sample_invinfo.po_bal_threshold, (FLDLEN32) sizeof(sample_invinfo.po_bal_threshold));
    510
    511
    512 }
    513 }
    514
    515 void add_ccinfo(FBFR32 *fbfr, int num_ccinfos)
    516 {
    517 char temp_string[BUFSIZ];
    518 int i;
    519
    520 add_fld(fbfr, "CC_INFO_OCC", (char *) &num_ccinfos, (FLDLEN32) sizeof(num_ccinfos));
    521
    522 for (i=0; i < num_ccinfos; i++)
    523 {
    524 sprintf(temp_string, sample_ccinfo.name);
    525 add_fld(fbfr, "NAME", temp_string, (FLDLEN32) strlen(temp_string));
    526
    527 sprintf(temp_string, sample_ccinfo.address);
    528 add_fld(fbfr, "ADDRESS", temp_string, (FLDLEN32) strlen(temp_string));
    529
    530 sprintf(temp_string, sample_ccinfo.city);
    531 add_fld(fbfr, "CITY", temp_string, (FLDLEN32) strlen(temp_string));
    532
    533 sprintf(temp_string, sample_ccinfo.state);
    534 add_fld(fbfr, "STATE", temp_string, (FLDLEN32) strlen(temp_string));
    535
    536 sprintf(temp_string, sample_ccinfo.zip);
    537 add_fld(fbfr, "ZIP", temp_string, (FLDLEN32) strlen(temp_string));
    538
    539 sprintf(temp_string, sample_ccinfo.country);
    540 add_fld(fbfr, "COUNTRY", temp_string, (FLDLEN32) strlen(temp_string));
    541
    542 sprintf(temp_string, sample_ccinfo.debit_num);
    543 add_fld(fbfr, "DEBIT_NUM", temp_string, (FLDLEN32) strlen(temp_string));
    544
    545 sprintf(temp_string, sample_ccinfo.debit_exp);
    546 add_fld(fbfr, "DEBIT_EXP", temp_string, (FLDLEN32) strlen(temp_string));
    547 }
    548 }
    549
    550 void add_nameinfo(FBFR32 *fbfr, int num_nameinfos)
    551 {
    552 char temp_string[BUFSIZ];
    553 int i;
    554
    555 add_fld(fbfr, "NAMEINFO_INFO_OCC", (char *) &num_nameinfos, (FLDLEN32) sizeof(num_nameinfos));
    556
    557 for (i=0; i < num_nameinfos; i++)
    558 {
    559 sprintf(temp_string, sample_nameinfo.lastname);
    560 add_fld(fbfr, "LAST_NAME", temp_string, (FLDLEN32) strlen(temp_string));
    561
    562 sprintf(temp_string, sample_nameinfo.address);
    563 add_fld(fbfr, "ADDRESS", temp_string, (FLDLEN32) strlen(temp_string));
    564
    565 sprintf(temp_string, sample_nameinfo.city);
    566 add_fld(fbfr, "CITY", temp_string, (FLDLEN32) strlen(temp_string));
    567
    568 sprintf(temp_string, sample_nameinfo.state);
    569 add_fld(fbfr, "STATE", temp_string, (FLDLEN32) strlen(temp_string));
    570
    571 sprintf(temp_string, sample_nameinfo.zip);
    572 add_fld(fbfr, "ZIP", temp_string, (FLDLEN32) strlen(temp_string));
    573
    574 sprintf(temp_string, sample_nameinfo.email_addr);
    575 add_fld(fbfr, "EMAIL_ADDR", temp_string, (FLDLEN32) strlen(temp_string));
    576
    577
    578
    579 sprintf(temp_string, sample_nameinfo.salutation);
    580 add_fld(fbfr, "SALUTATION", temp_string, (FLDLEN32) strlen(temp_string));
    581
    582
    583 sprintf(temp_string, sample_nameinfo.title);
    584 add_fld(fbfr, "TITLE", temp_string, (FLDLEN32) strlen(temp_string));
    585
    586 sprintf(temp_string, sample_nameinfo.contacttype);
    587 add_fld(fbfr, "CONTACT_TYPE", temp_string, (FLDLEN32) strlen(temp_string));
    588
    589 sprintf(temp_string, sample_nameinfo.company);
    590 add_fld(fbfr, "COMPANY", temp_string, (FLDLEN32) strlen(temp_string));
    591
    592 sprintf(temp_string, sample_nameinfo.firstname);
    593 add_fld(fbfr, "FIRST_NAME", temp_string, (FLDLEN32) strlen(temp_string));
    594
    595 sprintf(temp_string, sample_nameinfo.middlename);
    596 add_fld(fbfr, "MIDDLE_NAME", temp_string, (FLDLEN32) strlen(temp_string));
    597
    598 sprintf(temp_string, sample_nameinfo.country);
    599 add_fld(fbfr, "COUNTRY", temp_string, (FLDLEN32) strlen(temp_string));
    600
    601 add_fld(fbfr, "ELEMENT_ID", &sample_nameinfo.element_id, (FLDLEN32) sizeof(sample_nameinfo.element_id));
    602
    603 }
    604 }
    605
    606
    607
    608 void add_phonesinfo(FBFR32 *fbfr, int num_phoneinfos)
    609 {
    610 char temp_string[BUFSIZ];
    611 int i;
    612
    613 add_fld(fbfr, "PHONES_INFO_OCC", (char *) &num_phoneinfos, (FLDLEN32) sizeof(num_phoneinfos));
    614
    615 for (i=0; i < num_phoneinfos; i++)
    616 {
    617
    618 add_fld(fbfr, "TYPE", &sample_phones.type, (FLDLEN32) sizeof(sample_phones.type));
    619
    620 sprintf(temp_string, sample_phones.phone);
    621 add_fld(fbfr, "PHONE", temp_string, (FLDLEN32) strlen(temp_string));
    622
    623
    624
    625
    626 }
    627 }
    628
    629
    630 void add_exemptions(FBFR32 *fbfr, int num_exemptions)
    631 {
    632
    633 int i;
    634
    635 add_fld(fbfr, "EXEMPTIONS_INFO_OCC", (char *) &num_exemptions, (FLDLEN32) sizeof(num_exemptions));
    636
    637 for (i=0; i < num_exemptions; i++)
    638 {
    639
    640 add_fld(fbfr, "TYPE", &sample_exemptions.type, (FLDLEN32) sizeof(sample_exemptions.type));
    641
    642 add_fld(fbfr, "PERCENT", &sample_exemptions.percent, (FLDLEN32) sizeof(sample_exemptions.percent));
    643
    644
    645
    646 }
    647 }
    648
    649
    650 void add_actginfo(FBFR32 *fbfr, int num_actginfo)
    651 {
    652
    653 int i;
    654
    655 add_fld(fbfr, "ACTGINFO_INFO_OCC", (char *) &num_actginfo, (FLDLEN32) sizeof(num_actginfo));
    656
    657 for (i=0; i < num_actginfo; i++)
    658 {
    659
    660
    661 add_fld(fbfr, "ACTG_FUTURE_DOM", &sample_actginfo.actg_future_dom, (FLDLEN32) sizeof(sample_actginfo.actg_future_dom));
    662
    663 add_fld(fbfr, "ACTG_TYPE", &sample_actginfo.actg_type, (FLDLEN32) sizeof(sample_actginfo.actg_type));
    664 }
    665 }
    666
    667
    668 void add_locales(FBFR32 *fbfr, int num_locales)
    669 {
    670
    671 int i;
    672 char temp_string[BUFSIZ];
    673
    674
    675 add_fld(fbfr, "LOCALE_INFO_OCC", (char *) &num_locales, (FLDLEN32) sizeof(num_locales));
    676
    677 for (i=0; i < num_locales; i++)
    678 {
    679
    680 sprintf(temp_string, sample_locales.locale);
    681 add_fld(fbfr, "LOCALE", temp_string, (FLDLEN32) strlen(temp_string));
    682
    683 }
    684 }


Step 7.2 Build the Client Program

To build the client program use the eLink Platform utility buildclient.

buildclient -o create_cust -f create_cust.c

Step 7.3 Run the create_cust Program

With eLink Platform booted, the create_cust program can be run by specifying the service to invoke as the first command line parameter. The name of the service (from the adapter configuration file) is CREATE_CUST. Below shows a sample invocation:

$ create_cust CREATE_CUST

The Portal Infranet Adminstration utility can be used to view the account within the Portal Infranet system. See Figure 5-1.

Figure 5-1 Portal Infranet Administration Utility

 


Step 8: Shutdown the Application

Run tmshutdown to bring the eLink Adapter for Portal Infranet down. Listing 5-11 illustrates this process.

Listing 5-11 Sample Shutdown Procedure


$ tmshutdown
Shutdown all admin and server processes? (y/n): y
Shutting down all admin and server process in /usr/me/simpportal/tuxconfig
Shutting down server processes . . .
Server Id = 200 Group Id = EPORTALGRP Machine = elink: shutdown succeeded.
Shutting down admin processes . . .
Server Id = 0 Group Id = elink Machine = elink: shutdown succeeded.
2 processes stopped.