Installation and Getting Started Guide (On-Premises)

Installation and Getting Started Guide (On-Premises)

Example: Initializing Informatica Address Verification from a C Based Implementation

Example: Initializing Informatica Address Verification from a C Based Implementation

Before you can start processing addresses using Informatica Address Verification, you must call
AD_Initialize()
to initialize Address Verification. After you initialize Address Verification, you can call other functions such as
AD_GetAddressObject()
. After you complete address processing, call
AD_ReleaseAddressObject()
and
AD_DeInitialize()
to release the address object and close the Address Verification process.
The following example contains sample C code that contains
AD_Initialize()
,
AD_GetAddressObject()
,
AD_ReleaseAddressObject()
, and
AD_DeInitialize()
function calls. The sample code also contains one Singapore address that you can validate to verify that the Address Verification implementation is working correctly.
AD_AOHandle hAOHandle; char sResultXML[ 16 * 1024 ]; AD_Initialize( "<?xml version='1.0' encoding='iso-8859-1' ?>\n" "<!DOCTYPE SetConfig SYSTEM 'SetConfig.dtd'>\n" "<SetConfig>\n" "<General />\n" "<UnlockCode>
(Enter Code here)
</UnlockCode>\n" "<DataBase CountryISO3='ALL' Type='BATCH_INTERACTIVE' Path='/ADDB' PreloadingType='NONE'/>\n" "</SetConfig>\n", NULL, NULL, NULL ); AD_GetAddressObject( &hAOHandle ); AD_SetInputDataXML( hAOHandle, "<?xml version='1.0' encoding='ISO-8859-1'?>\n" "<!DOCTYPE InputData SYSTEM 'InputData.dtd'>\n" "<InputData>\n" "<AddressElements>\n" "<Country Item='1' Type='NAME'>SGP</Country>\n" "<Locality Item='1' Type='COMPLETE'>Singapore</Locality>\n" "<PostalCode Item='1' Type='FORMATTED'>048624</PostalCode>\n" "<Street Item='1' Type='COMPLETE'>Raffles Place</Street>\n" "<Number Item='1' Type='COMPLETE'>80</Number>\n" "<Building Item='1' Type='COMPLETE'>#50-01 UOB Plaza 1</Building>\n" "<Organization Item='1' Type='NAME'>AddressDoctor GmbH</Organization>\n" "</AddressElements>\n" "</InputData>\n" ); AD_Process( hAOHandle ); AD_GetResultXML( hAOHandle, sResultXML, sizeof( sResultXML ) ); AD_ReleaseAddressObject( hAOHandle ); AD_DeInitialize();
Address Verification returns the processed output in the format defined in
Result.dtd
. For more information about the XML format used for results, see the
Result.dtd
file. The following example shows the results generated for the
AD_GetResultXML()
call in the first code sample shown in the preceding example:
<?xml version="1.0" encoding="UTF-16"?> <Result ProcessStatus="V2" ModeUsed="BATCH" Count="1" CountOverflow="NO" CountryISO3="SGP" PreferredScript="DATABASE" PreferredLanguage="DATABASE"> <ResultData ResultNumber="1" MailabilityScore="4" ResultPercentage="100.00" ElementResultStatus="F0F000F0F000404440E0" ElementInputStatus="60600060600020222060" ElementRelevance="10100010100000000010"> <AddressElements> <Country Type="NAME_EN" Item="1">SINGAPORE</Country> <Locality Item="1">SINGAPORE</Locality> <PostalCode Item="1">048624</PostalCode> <Street Item="1">RAFFLES PLACE</Street> <Number Item="1">80</Number> <Building Item="1">UOB PLAZA 1</Building> <SubBuilding Item="1"># 50</SubBuilding> <SubBuilding Item="2">01</SubBuilding> <Organization Item="1">ADDRESSDOCTOR GMBH</Organization> </AddressElements> <AddressLines> <RecipientLine Line="1">ADDRESSDOCTOR GMBH</RecipientLine> <DeliveryAddressLine Line="1">80 RAFFLES PLACE</DeliveryAddressLine> <DeliveryAddressLine Line="2">#50-01 UOB PLAZA 1</DeliveryAddressLine> <CountrySpecificLocalityLine Line="1">SINGAPORE 048624</CountrySpecificLocalityLine> <FormattedAddressLine Line="1">ADDRESSDOCTOR GMBH</FormattedAddressLine> <FormattedAddressLine Line="2">80 RAFFLES PLACE</FormattedAddressLine> <FormattedAddressLine Line="3">#50-01 UOB PLAZA 1</FormattedAddressLine> <FormattedAddressLine Line="4">SINGAPORE 048624</FormattedAddressLine> </AddressLines> <AddressComplete>ADDRESSDOCTOR GMBH 80 RAFFLES PLACE #50-01 UOB PLAZA 1 SINGAPORE 048624 </AddressComplete> </ResultData> </Result>
After you successfully test the Address Verification implementation, you can compile your application. The procedure for compiling the application varies greatly among different platforms and compilers.
The following example shows the command for compiling the ConsoleDemo C++ application, which comes in the
src
folder of the download package, on a Linux device by using the GNU compiler collection (gcc) compiler:
gcc -Iinclude -Llib -lAddressDoctor5 -lpthread -o bin/ConsoleDemo src/ConsoleDemo.cpp

0 COMMENTS

We’d like to hear from you!