As part of our commitment to making our data quality solutions easy to integrate, our Application Engineering team has developed a series of tutorials on how to integrate our services. The series highlights various programming languages, with this tutorial exploring the “how-to’s” of applying our services using ColdFusion.
ColdFusion is a scripting language that has been around since 1995. It was created to make development of CGI scripts easier and faster. ColdFusion has unique aspects, including use of its native ColdFusion Markup Language (CMFL for short) to allow HTML style tags for programming with systems. Like most things in the tech world, it can draw a lot of polarized opinions, where some are ardent supporters, and others, less than enthusiastic fans. If you fall in the supporter camp, and want to learn how to call a web service with ColdFusion, that is where our experts can step in and help.
To get started you will need a ColdFusion IDE (we’re using ColdFusion Builder 3) and a Service Objects’ License key. We’re using one for DOTS Lead Validation but you can follow along with your service of choice.
Project setup
The first step is to launch your IDE and select an appropriate workspace for your project. Next, we will create a new project.
Select next for a blank template and then click next again. On the following screen give your project an appropriate name and click finish.
Congratulations! You created a brand new ColdFusion project. Now it’s time to add some code. For starters, we’ll want to add a form and elements to initialize our form inputs so that we can create a sample page to input data to send to our web service. This likely won’t be what you will want to do in a live environment, but this is for demonstration purposes.
The DOTS Lead Validation service that we’re using has quite a few inputs so this may take a while. Once you are finished it should look like the following:
<cfif NOT isdefined("form.FullName")><cfset form.FullName=""></cfif> <cfif NOT isdefined("form.Salutation")><cfset form.Salutation=""></cfif> <cfif NOT isdefined("form.FirstName")><cfset form.FirstName=""></cfif> <cfif NOT isdefined("form.LastName")><cfset form.LastName=""></cfif> <cfif NOT isdefined("form.BusinessName")><cfset form.BusinessName=""></cfif> <cfif NOT isdefined("form.BusinessDomain")><cfset form.BusinessDomain=""></cfif> <cfif NOT isdefined("form.BusinessEIN")><cfset form.BusinessEIN=""></cfif> <cfif NOT isdefined("form.Address1")><cfset form.Address1=""></cfif> <cfif NOT isdefined("form.Address2")><cfset form.Address2=""></cfif> <cfif NOT isdefined("form.Address3")><cfset form.Address3=""></cfif> <cfif NOT isdefined("form.Address4")><cfset form.Address4=""></cfif> <cfif NOT isdefined("form.Address5")><cfset form.Address5=""></cfif> <cfif NOT isdefined("form.Locality")><cfset form.Locality=""></cfif> <cfif NOT isdefined("form.AdminArea")><cfset form.AdminArea=""></cfif> <cfif NOT isdefined("form.PostalCode")><cfset form.PostalCode=""></cfif> <cfif NOT isdefined("form.Country")><cfset form.Country=""></cfif> <cfif NOT isdefined("form.Phone1")><cfset form.Phone1=""></cfif> <cfif NOT isdefined("form.Phone2")><cfset form.Phone2=""></cfif> <cfif NOT isdefined("form.Email")><cfset form.Email=""></cfif> <cfif NOT isdefined("form.IPAddress")><cfset form.IPAddress=""></cfif> <cfif NOT isdefined("form.Gender")><cfset form.Gender=""></cfif> <cfif NOT isdefined("form.DateOfBirth")><cfset form.DateOfBirth=""></cfif> <cfif NOT isdefined("form.UTCCaptureTime")><cfset form.UTCCaptureTime=""></cfif> <cfif NOT isdefined("form.OutputLanguage")><cfset form.OutputLanguage=""></cfif> <cfif NOT isdefined("form.TestType")><cfset form.TestType=""></cfif> <cfif NOT isdefined("form.LicenseKey")><cfset form.LicenseKey=""></cfif> <cfif NOT isdefined("form.Action")><cfset form.Action=""></cfif> <form action="index.cfm"> <table cellpadding="2" cellspacing="2"> <b>ColdFusion Integration Tutorial - Sample Form</b> </br> <tr><td>FullName:</td><td><input type="text" name="FullName" value="<cfoutput>#FullName#</cfoutput>" size="30"></td></tr> <tr><td>Salutation:</td><td><input type="text" name="Salutation" value="<cfoutput>#Salutation#</cfoutput>" size="30"></td></tr> <tr><td>FirstName:</td><td><input type="text" name="FirstName" value="<cfoutput>#FirstName#</cfoutput>" size="30"></td></tr> <tr><td>LastName:</td><td><input type="text" name="LastName" value="<cfoutput>#LastName#</cfoutput>" size="30"></td></tr> <tr><td>BusinessName:</td><td><input type="text" name="BusinessName" value="<cfoutput>#BusinessName#</cfoutput>" size="30"></td></tr> <tr><td>BusinessDomain:</td><td><input type="text" name="BusinessDomain" value="<cfoutput>#BusinessDomain#</cfoutput>" size="30"></td></tr> <tr><td>BusinessEIN:</td><td><input type="text" name="BusinessEIN" value="<cfoutput>#BusinessEIN#</cfoutput>" size="30"></td></tr> <tr><td>Address1:</td><td><input type="text" name="Address1" value="<cfoutput>#Address1#</cfoutput>" size="30"></td></tr> <tr><td>Address2:</td><td><input type="text" name="Address2" value="<cfoutput>#Address2#</cfoutput>" size="30"></td></tr> <tr><td>Address3:</td><td><input type="text" name="Address3" value="<cfoutput>#Address3#</cfoutput>" size="30"></td></tr> <tr><td>Address4:</td><td><input type="text" name="Address4" value="<cfoutput>#Address4#</cfoutput>" size="30"></td></tr> <tr><td>Address5:</td><td><input type="text" name="Address5" value="<cfoutput>#Address5#</cfoutput>" size="30"></td></tr> <tr><td>Locality:</td><td><input type="text" name="Locality" value="<cfoutput>#Locality#</cfoutput>" size="30"></td></tr> <tr><td>AdminArea:</td><td><input type="text" name="AdminArea" value="<cfoutput>#AdminArea#</cfoutput>" size="30"></td></tr> <tr><td>PostalCode:</td><td><input type="text" name="PostalCode" value="<cfoutput>#PostalCode#</cfoutput>" size="30"></td></tr> <tr><td>Country:</td><td><input type="text" name="Country" value="<cfoutput>#Country#</cfoutput>" size="30"></td></tr> <tr><td>Phone1:</td><td><input type="text" name="Phone1" value="<cfoutput>#Phone1#</cfoutput>" size="30"></td></tr> <tr><td>Phone2:</td><td><input type="text" name="Phone2" value="<cfoutput>#Phone2#</cfoutput>" size="30"></td></tr> <tr><td>Email:</td><td><input type="text" name="Email" value="<cfoutput>#Email#</cfoutput>" size="30"></td></tr> <tr><td>IPAddress:</td><td><input type="text" name="IPAddress" value="<cfoutput>#IPAddress#</cfoutput>" size="30"></td></tr> <tr><td>Gender:</td><td><input type="text" name="Gender" value="<cfoutput>#Gender#</cfoutput>" size="30"></td></tr> <tr><td>DateOfBirth:</td><td><input type="text" name="DateOfBirth" value="<cfoutput>#DateOfBirth#</cfoutput>" size="30"></td></tr> <tr><td>UTCCaptureTime:</td><td><input type="text" name="UTCCaptureTime" value="<cfoutput>#UTCCaptureTime#</cfoutput>" size="30"></td></tr> <tr><td>OutputLanguage:</td><td><input type="text" name="OutputLanguage" value="<cfoutput>#OutputLanguage#</cfoutput>" size="30"></td></tr> <tr><td>TestType:</td><td><input type="text" name="TestType" value="<cfoutput>#TestType#</cfoutput>" size="30"></td></tr> <tr><td>License Key:</td><td><input type="text" name="LicenseKey" value="<cfoutput>#LicenseKey#</cfoutput>" size="30" ></td></tr> <tr><td colspan="2"><br /><input type="Submit" name="Action" value="Submit"></td></tr><tr><td colspan="2"></td></tr> </table> </form>
Making the web service call
The next bit of code that we will add is to make the actual HTTP GET call to the Service Objects’ web service. Let’s use the CFML tags to make the actual web service call.
<cfIf isDefined("form.Action") AND Action neq "" > <cftry> <cfset primaryURL = "https://trial.serviceobjects.com/LV/api.svc/ValidateLead_V3?FullName=#FullName#&Salutation=#Salutation#&FirstName=#FirstName#&LastName=#LastName#&BusinessName=#BusinessName#&BusinessDomain=#BusinessDomain#&BusinessEIN=#BusinessEIN#&Address1=#Address1#&Address2=#Address2#&Address3=#Address3#&Address4=#Address4#&Address5=#Address5#&Locality=#Locality#&AdminArea=#AdminArea#&PostalCode=#PostalCode#&Country=#Country#&Phone1=#Phone1#&Phone2=#Phone2#&Email=#Email#&IPAddress=#IPAddress#&Gender=#Gender#&DateOfBirth=#DateOfBirth#&UTCCaptureTime=#UTCCaptureTime#&OutputLanguage=#OutputLanguage#&TestType=#TestType#&LicenseKey=#LicenseKey#"> <cfhttp url="#primaryURL#" method="get" result="response"> <cfset outputs = XmlParse(response.FileContent)> <cfif (isNull(outputs) OR (!isNull(outputs.ContactInternational.Error) AND (outputs.ContactInternational.Error.TypeCode is "3"))) > <cfthrow message="BackupCall Used"> </cfif> <cfcatch > <cftry> <cfset backupURL = "https://trial.serviceobjects.com/LV/api.svc/ValidateLead_V3?FullName=#FullName#&Salutation=#Salutation#&FirstName=#FirstName#&LastName=#LastName#&BusinessName=#BusinessName#&BusinessDomain=#BusinessDomain#&BusinessEIN=#BusinessEIN#&Address1=#Address1#&Address2=#Address2#&Address3=#Address3#&Address4=#Address4#&Address5=#Address5#&Locality=#Locality#&AdminArea=#AdminArea#&PostalCode=#PostalCode#&Country=#Country#&Phone1=#Phone1#&Phone2=#Phone2#&Email=#Email#&IPAddress=#IPAddress#&Gender=#Gender#&DateOfBirth=#DateOfBirth#&UTCCaptureTime=#UTCCaptureTime#&OutputLanguage=#OutputLanguage#&TestType=#TestType#&LicenseKey=#LicenseKey#"> <cfhttp url="#backupURL#" method="get" result="response"> <cfset outputs = XmlParse(outputs.FileContent)> <cfdump var="#outputs#"> <cfcatch > <cfoutput > The Following Error Occured: #response.StatusCode# </cfoutput> </cfcatch> </cftry> </cfcatch> </cftry> </cfif>
After the code makes the call to the trial.serviceobjects.com endpoint, we perform a failover check in the code. This failover check and the try catch blocks that it is nested in will help ensure that your integration of our web service will continue to work uninterrupted in the event that the primary web service is unavailable or not responding correctly.
The primary endpoint should be pointing to sws.serviceobjects.com and the backup endpoint should be pointed to swsbackup.serviceobjects.com.
Displaying the results
Now that you have successfully called the web service, you will obviously want to do something with the results. For demonstration purposes we will simply display the results to the user. You can use the code snippet below to display.
<cfif isDefined("form.Action") AND Action neq "" > <cftry> <cfif !isNull(outputs.ContactInternational.Error)> <cfset responseError = outputs.ContactInternational.Error> <cfoutput> <b>Errors Found!</b> <table width="450" border="1" cellpadding="2" cellspacing="2"> <tr><td>Error Description:</td><td>#responseError.Desc.XmlText#</td></tr> <tr><td>Error Description Code:</td><td> #responseError.DescCode.XmlText#</td></tr> <tr><td>Error Type:</td><td> #responseError.Type.XmlText#</td></tr> <tr><td>Error Type Code:</td><td> #responseError.TypeCode.XmlText#</td></tr> </table> </cfoutput> <cfelse> <!--No errors found, display results--> <cfoutput> <b>Lead Validation - Results:</b> </br> <cfset validResponse = outputs.ContactInternational> <table width="450" border="1" cellpadding="2" cellspacing="2"> <tr><td>OverallCertainty:</td><td>#validResponse.OverallCertainty.XmlText#</td></tr> <tr><td>OverallQuality:</td><td>#validResponse.OverallQuality.XmlText#</td></tr> <tr><td>LeadType:</td><td>#validResponse.LeadType.XmlText#</td></tr> <tr><td>LeadCountry:</td><td>#validResponse.LeadCountry.XmlText#</td></tr> <tr><td>NoteCodes:</td><td>#validResponse.NoteCodes.XmlText#</td></tr> <tr><td>NoteDesc:</td><td>#validResponse.NoteDesc.XmlText#</td></tr> <tr><td>NameCertainty:</td><td>#validResponse.NameCertainty.XmlText#</td></tr> <tr><td>NameQuality:</td><td>#validResponse.NameQuality.XmlText#</td></tr> <tr><td>FirstNameLatin:</td><td>#validResponse.FirstNameLatin.XmlText#</td></tr> <tr><td>LastNameLatin:</td><td>#validResponse.LastNameLatin.XmlText#</td></tr> <tr><td>FirstName:</td><td>#validResponse.FirstName.XmlText#</td></tr> <tr><td>LastName:</td><td>#validResponse.LastName.XmlText#</td></tr> <tr><td>NameNoteCodes:</td><td>#validResponse.NameNoteCodes.XmlText#</td></tr> <tr><td>NameNoteDesc:</td><td>#validResponse.NameNoteDesc.XmlText#</td></tr> <tr><td>AddressCertainty:</td><td>#validResponse.AddressCertainty.XmlText#</td></tr> <tr><td>AddressResolutionLevel:</td><td>#validResponse.AddressResolutionLevel.XmlText#</td></tr> <tr><td>Address1:</td><td><cfif isDefined("validResponse.AddressLine1.XmlText")>#validResponse.AddressLine1.XmlText#</cfif></td></tr> <tr><td>Address2:</td><td><cfif isDefined("validResponse.AddressLine2.XmlText")>#validResponse.AddressLine2.XmlText#</cfif></td></tr> <tr><td>Address3:</td><td><cfif isDefined("validResponse.AddressLine3.XmlText")>#validResponse.AddressLine3.XmlText#</cfif></td></tr> <tr><td>Address4:</td><td><cfif isDefined("validResponse.AddressLine4.XmlText")>#validResponse.AddressLine4.XmlText#</cfif></td></tr> <tr><td>Address5:</td><td><cfif isDefined("validResponse.AddressLine5.XmlText")>#validResponse.AddressLine5.XmlText#</cfif></td></tr> <tr><td>AddressLocality:</td><td>#validResponse.AddressLocality.XmlText#</td></tr> <tr><td>AddressAdminArea:</td><td>#validResponse.AddressAdminArea.XmlText#</td></tr> <tr><td>AddressPostalCode:</td><td>#validResponse.AddressPostalCode.XmlText#</td></tr> <tr><td>AddressNoteCodes:</td><td>#validResponse.AddressNoteCodes.XmlText#</td></tr> <tr><td>AddressNoteDesc:</td><td>#validResponse.AddressNoteDesc.XmlText#</td></tr> <tr><td>EmailCertainty:</td><td>#validResponse.EmailCertainty.XmlText#</td></tr> <tr><td>EmailQuality:</td><td>#validResponse.EmailQuality.XmlText#</td></tr> <tr><td>EmailCorrected:</td><td>#validResponse.EmailCorrected.XmlText#</td></tr> <tr><td>EmailNoteCodes:</td><td>#validResponse.EmailNoteCodes.XmlText#</td></tr> <tr><td>EmailNoteDesc:</td><td>#validResponse.EmailNoteDesc.XmlText#</td></tr> <tr><td>IPCertainty:</td><td>#validResponse.IPCertainty.XmlText#</td></tr> <tr><td>IPQuality:</td><td>#validResponse.IPQuality.XmlText#</td></tr> <tr><td>IPLocality:</td><td>#validResponse.IPLocality.XmlText#</td></tr> <tr><td>IPAdminArea:</td><td>#validResponse.IPAdminArea.XmlText#</td></tr> <tr><td>IPCountry:</td><td>#validResponse.IPCountry.XmlText#</td></tr> <tr><td>IPNoteCodes:</td><td>#validResponse.IPNoteCodes.XmlText#</td></tr> <tr><td>IPNoteDesc:</td><td>#validResponse.IPNoteDesc.XmlText#</td></tr> <tr><td>Phone1Certainty:</td><td>#validResponse.Phone1Certainty.XmlText#</td></tr> <tr><td>Phone1Quality:</td><td>#validResponse.Phone1Quality.XmlText#</td></tr> <tr><td>Phone1Locality:</td><td>#validResponse.Phone1Locality.XmlText#</td></tr> <tr><td>Phone1AdminArea:</td><td>#validResponse.Phone1AdminArea.XmlText#</td></tr> <tr><td>Phone1NoteCodes:</td><td>#validResponse.Phone1NoteCodes.XmlText#</td></tr> <tr><td>Phone1NoteDesc:</td><td>#validResponse.Phone1NoteDesc.XmlText#</td></tr> <tr><td>BusinessCertainty:</td><td>#validResponse.BusinessCertainty.XmlText#</td></tr> <tr><td>BusinessQuality:</td><td>#validResponse.BusinessQuality.XmlText#</td></tr> <tr><td>BusinessName:</td><td>#validResponse.BusinessName.XmlText#</td></tr> <tr><td>BusinessDomain:</td><td>#validResponse.BusinessDomain.XmlText#</td></tr> <tr><td>BusinessEmail:</td><td>#validResponse.BusinessEmail.XmlText#</td></tr> <tr><td>BusinessNoteCodes:</td><td>#validResponse.BusinessNoteCodes.XmlText#</td></tr> <tr><td>BusinessNoteDesc:</td><td>#validResponse.BusinessNoteDesc.XmlText#</td></tr> </table> <cfif Len(validResponse.InformationComponents) GT 0> <cfif isDefined("validResponse.InformationComponents.InformationComponent.XmlText")> <br><b>Information Components</b> <table width="450" border="1" cellpadding="2" cellspacing="2"> <cfset infoComponent = validResponse.InformationComponents.InformationComponent> <cfloop from ="1" to="#ArrayLen(infoComponent)#" index ="i"> <tr><td>#infoComponent[i].Name.XmlText#</td><td>#infoComponent[i].Value.XmlText#</td></tr> </cfloop> </cfif> </cfif> <cfif Len(validResponse.PhoneContact) GT 0> <br><b>Phone Contacts</b> <table width="450" border="1" cellpadding="2" cellspacing="2"> <cfset phoneContact = validResponse.PhoneContact> <tr><td>Name</td><td>#PhoneContact.Name.XmlText#</td></tr> <tr><td>Address</td><td>#PhoneContact.Address.XmlText#</td></tr> <tr><td>City</td><td>#PhoneContact.City.XmlText#</td></tr> <tr><td>State</td><td>#PhoneContact.State.XmlText#</td></tr> <tr><td>Zip</td><td>#PhoneContact.Zip.XmlText#</td></tr> <tr><td>Name</td><td>#PhoneContact.Name.XmlText#</td></tr> </cfif> </table> </cfoutput> </cfif> <cfcatch> <cfoutput> </br> <tr><td><b>Unable to process request. #cfcatch.message#</b></td></tr> </cfoutput> </cfcatch> </cftry> </cfif>
If you are having trouble figuring out how a particular output is mapped in the ColdFusion response, then you can use the <cfdump var=””> tag to dump the outputs onto the screen. This should allow for easy troubleshooting.
Now that our CFML is all set up, lets see an example input and output from the service. Below is sample lead information that you might encounter:
And here is some of the response that DOTS Lead Validation will return:
The DOTS Lead Validation service can return a multitude of information about your lead. To download a trial key for any of our 23 contact validation solutions, please visit https://www.serviceobjects.com/products
P.S. Here is the full ColdFusion script page in case you need it to get up and running.
<cfif NOT isdefined("form.FullName")><cfset form.FullName=""></cfif> <cfif NOT isdefined("form.Salutation")><cfset form.Salutation=""></cfif> <cfif NOT isdefined("form.FirstName")><cfset form.FirstName=""></cfif> <cfif NOT isdefined("form.LastName")><cfset form.LastName=""></cfif> <cfif NOT isdefined("form.BusinessName")><cfset form.BusinessName=""></cfif> <cfif NOT isdefined("form.BusinessDomain")><cfset form.BusinessDomain=""></cfif> <cfif NOT isdefined("form.BusinessEIN")><cfset form.BusinessEIN=""></cfif> <cfif NOT isdefined("form.Address1")><cfset form.Address1=""></cfif> <cfif NOT isdefined("form.Address2")><cfset form.Address2=""></cfif> <cfif NOT isdefined("form.Address3")><cfset form.Address3=""></cfif> <cfif NOT isdefined("form.Address4")><cfset form.Address4=""></cfif> <cfif NOT isdefined("form.Address5")><cfset form.Address5=""></cfif> <cfif NOT isdefined("form.Locality")><cfset form.Locality=""></cfif> <cfif NOT isdefined("form.AdminArea")><cfset form.AdminArea=""></cfif> <cfif NOT isdefined("form.PostalCode")><cfset form.PostalCode=""></cfif> <cfif NOT isdefined("form.Country")><cfset form.Country=""></cfif> <cfif NOT isdefined("form.Phone1")><cfset form.Phone1=""></cfif> <cfif NOT isdefined("form.Phone2")><cfset form.Phone2=""></cfif> <cfif NOT isdefined("form.Email")><cfset form.Email=""></cfif> <cfif NOT isdefined("form.IPAddress")><cfset form.IPAddress=""></cfif> <cfif NOT isdefined("form.Gender")><cfset form.Gender=""></cfif> <cfif NOT isdefined("form.DateOfBirth")><cfset form.DateOfBirth=""></cfif> <cfif NOT isdefined("form.UTCCaptureTime")><cfset form.UTCCaptureTime=""></cfif> <cfif NOT isdefined("form.OutputLanguage")><cfset form.OutputLanguage=""></cfif> <cfif NOT isdefined("form.TestType")><cfset form.TestType=""></cfif> <cfif NOT isdefined("form.LicenseKey")><cfset form.LicenseKey=""></cfif> <cfif NOT isdefined("form.Action")><cfset form.Action=""></cfif> <form action="index.cfm"> <table cellpadding="2" cellspacing="2"> <b>ColdFusion Integration Tutorial - Sample Form</b> </br> <tr><td>FullName:</td><td><input type="text" name="FullName" value="<cfoutput>#FullName#</cfoutput>" size="30"></td></tr> <tr><td>Salutation:</td><td><input type="text" name="Salutation" value="<cfoutput>#Salutation#</cfoutput>" size="30"></td></tr> <tr><td>FirstName:</td><td><input type="text" name="FirstName" value="<cfoutput>#FirstName#</cfoutput>" size="30"></td></tr> <tr><td>LastName:</td><td><input type="text" name="LastName" value="<cfoutput>#LastName#</cfoutput>" size="30"></td></tr> <tr><td>BusinessName:</td><td><input type="text" name="BusinessName" value="<cfoutput>#BusinessName#</cfoutput>" size="30"></td></tr> <tr><td>BusinessDomain:</td><td><input type="text" name="BusinessDomain" value="<cfoutput>#BusinessDomain#</cfoutput>" size="30"></td></tr> <tr><td>BusinessEIN:</td><td><input type="text" name="BusinessEIN" value="<cfoutput>#BusinessEIN#</cfoutput>" size="30"></td></tr> <tr><td>Address1:</td><td><input type="text" name="Address1" value="<cfoutput>#Address1#</cfoutput>" size="30"></td></tr> <tr><td>Address2:</td><td><input type="text" name="Address2" value="<cfoutput>#Address2#</cfoutput>" size="30"></td></tr> <tr><td>Address3:</td><td><input type="text" name="Address3" value="<cfoutput>#Address3#</cfoutput>" size="30"></td></tr> <tr><td>Address4:</td><td><input type="text" name="Address4" value="<cfoutput>#Address4#</cfoutput>" size="30"></td></tr> <tr><td>Address5:</td><td><input type="text" name="Address5" value="<cfoutput>#Address5#</cfoutput>" size="30"></td></tr> <tr><td>Locality:</td><td><input type="text" name="Locality" value="<cfoutput>#Locality#</cfoutput>" size="30"></td></tr> <tr><td>AdminArea:</td><td><input type="text" name="AdminArea" value="<cfoutput>#AdminArea#</cfoutput>" size="30"></td></tr> <tr><td>PostalCode:</td><td><input type="text" name="PostalCode" value="<cfoutput>#PostalCode#</cfoutput>" size="30"></td></tr> <tr><td>Country:</td><td><input type="text" name="Country" value="<cfoutput>#Country#</cfoutput>" size="30"></td></tr> <tr><td>Phone1:</td><td><input type="text" name="Phone1" value="<cfoutput>#Phone1#</cfoutput>" size="30"></td></tr> <tr><td>Phone2:</td><td><input type="text" name="Phone2" value="<cfoutput>#Phone2#</cfoutput>" size="30"></td></tr> <tr><td>Email:</td><td><input type="text" name="Email" value="<cfoutput>#Email#</cfoutput>" size="30"></td></tr> <tr><td>IPAddress:</td><td><input type="text" name="IPAddress" value="<cfoutput>#IPAddress#</cfoutput>" size="30"></td></tr> <tr><td>Gender:</td><td><input type="text" name="Gender" value="<cfoutput>#Gender#</cfoutput>" size="30"></td></tr> <tr><td>DateOfBirth:</td><td><input type="text" name="DateOfBirth" value="<cfoutput>#DateOfBirth#</cfoutput>" size="30"></td></tr> <tr><td>UTCCaptureTime:</td><td><input type="text" name="UTCCaptureTime" value="<cfoutput>#UTCCaptureTime#</cfoutput>" size="30"></td></tr> <tr><td>OutputLanguage:</td><td><input type="text" name="OutputLanguage" value="<cfoutput>#OutputLanguage#</cfoutput>" size="30"></td></tr> <tr><td>TestType:</td><td><input type="text" name="TestType" value="<cfoutput>#TestType#</cfoutput>" size="30"></td></tr> <tr><td>License Key:</td><td><input type="text" name="LicenseKey" value="<cfoutput>#LicenseKey#</cfoutput>" size="30" ></td></tr> <tr><td colspan="2"><br /><input type="Submit" name="Action" value="Submit"></td></tr><tr><td colspan="2"></td></tr> </table> </form> <cfIf isDefined("form.Action") AND Action neq "" > <cftry> <cfset primaryURL = "https://trial.serviceobjects.com/LV/api.svc/ValidateLead_V3?FullName=#FullName#&Salutation=#Salutation#&FirstName=#FirstName#&LastName=#LastName#&BusinessName=#BusinessName#&BusinessDomain=#BusinessDomain#&BusinessEIN=#BusinessEIN#&Address1=#Address1#&Address2=#Address2#&Address3=#Address3#&Address4=#Address4#&Address5=#Address5#&Locality=#Locality#&AdminArea=#AdminArea#&PostalCode=#PostalCode#&Country=#Country#&Phone1=#Phone1#&Phone2=#Phone2#&Email=#Email#&IPAddress=#IPAddress#&Gender=#Gender#&DateOfBirth=#DateOfBirth#&UTCCaptureTime=#UTCCaptureTime#&OutputLanguage=#OutputLanguage#&TestType=#TestType#&LicenseKey=#LicenseKey#"> <cfhttp url="#primaryURL#" method="get" result="response"> <cfset outputs = XmlParse(response.FileContent)> <cfif (isNull(outputs) OR (!isNull(outputs.ContactInternational.Error) AND (outputs.ContactInternational.Error.TypeCode is "3"))) > <cfthrow message="BackupCall Used"> </cfif> <cfcatch > <cftry> <cfset backupURL = "https://trial.serviceobjects.com/LV/api.svc/ValidateLead_V3?FullName=#FullName#&Salutation=#Salutation#&FirstName=#FirstName#&LastName=#LastName#&BusinessName=#BusinessName#&BusinessDomain=#BusinessDomain#&BusinessEIN=#BusinessEIN#&Address1=#Address1#&Address2=#Address2#&Address3=#Address3#&Address4=#Address4#&Address5=#Address5#&Locality=#Locality#&AdminArea=#AdminArea#&PostalCode=#PostalCode#&Country=#Country#&Phone1=#Phone1#&Phone2=#Phone2#&Email=#Email#&IPAddress=#IPAddress#&Gender=#Gender#&DateOfBirth=#DateOfBirth#&UTCCaptureTime=#UTCCaptureTime#&OutputLanguage=#OutputLanguage#&TestType=#TestType#&LicenseKey=#LicenseKey#"> <cfhttp url="#backupURL#" method="get" result="response"> <cfset outputs = XmlParse(outputs.FileContent)> <cfdump var="#outputs#"> <cfcatch > <cfoutput > The Following Error Occured: #response.StatusCode# </cfoutput> </cfcatch> </cftry> </cfcatch> </cftry> </cfif> <cfif isDefined("form.Action") AND Action neq "" > <cftry> <cfif !isNull(outputs.ContactInternational.Error)> <cfset responseError = outputs.ContactInternational.Error> <cfoutput> <b>Errors Found!</b> <table width="450" border="1" cellpadding="2" cellspacing="2"> <tr><td>Error Description:</td><td>#responseError.Desc.XmlText#</td></tr> <tr><td>Error Description Code:</td><td> #responseError.DescCode.XmlText#</td></tr> <tr><td>Error Type:</td><td> #responseError.Type.XmlText#</td></tr> <tr><td>Error Type Code:</td><td> #responseError.TypeCode.XmlText#</td></tr> </table> </cfoutput> <cfelse> <!--No errors found, display results--> <cfoutput> <b>Lead Validation - Results:</b> </br> <cfset validResponse = outputs.ContactInternational> <table width="450" border="1" cellpadding="2" cellspacing="2"> <tr><td>OverallCertainty:</td><td>#validResponse.OverallCertainty.XmlText#</td></tr> <tr><td>OverallQuality:</td><td>#validResponse.OverallQuality.XmlText#</td></tr> <tr><td>LeadType:</td><td>#validResponse.LeadType.XmlText#</td></tr> <tr><td>LeadCountry:</td><td>#validResponse.LeadCountry.XmlText#</td></tr> <tr><td>NoteCodes:</td><td>#validResponse.NoteCodes.XmlText#</td></tr> <tr><td>NoteDesc:</td><td>#validResponse.NoteDesc.XmlText#</td></tr> <tr><td>NameCertainty:</td><td>#validResponse.NameCertainty.XmlText#</td></tr> <tr><td>NameQuality:</td><td>#validResponse.NameQuality.XmlText#</td></tr> <tr><td>FirstNameLatin:</td><td>#validResponse.FirstNameLatin.XmlText#</td></tr> <tr><td>LastNameLatin:</td><td>#validResponse.LastNameLatin.XmlText#</td></tr> <tr><td>FirstName:</td><td>#validResponse.FirstName.XmlText#</td></tr> <tr><td>LastName:</td><td>#validResponse.LastName.XmlText#</td></tr> <tr><td>NameNoteCodes:</td><td>#validResponse.NameNoteCodes.XmlText#</td></tr> <tr><td>NameNoteDesc:</td><td>#validResponse.NameNoteDesc.XmlText#</td></tr> <tr><td>AddressCertainty:</td><td>#validResponse.AddressCertainty.XmlText#</td></tr> <tr><td>AddressResolutionLevel:</td><td>#validResponse.AddressResolutionLevel.XmlText#</td></tr> <tr><td>Address1:</td><td><cfif isDefined("validResponse.AddressLine1.XmlText")>#validResponse.AddressLine1.XmlText#</cfif></td></tr> <tr><td>Address2:</td><td><cfif isDefined("validResponse.AddressLine2.XmlText")>#validResponse.AddressLine2.XmlText#</cfif></td></tr> <tr><td>Address3:</td><td><cfif isDefined("validResponse.AddressLine3.XmlText")>#validResponse.AddressLine3.XmlText#</cfif></td></tr> <tr><td>Address4:</td><td><cfif isDefined("validResponse.AddressLine4.XmlText")>#validResponse.AddressLine4.XmlText#</cfif></td></tr> <tr><td>Address5:</td><td><cfif isDefined("validResponse.AddressLine5.XmlText")>#validResponse.AddressLine5.XmlText#</cfif></td></tr> <tr><td>AddressLocality:</td><td>#validResponse.AddressLocality.XmlText#</td></tr> <tr><td>AddressAdminArea:</td><td>#validResponse.AddressAdminArea.XmlText#</td></tr> <tr><td>AddressPostalCode:</td><td>#validResponse.AddressPostalCode.XmlText#</td></tr> <tr><td>AddressNoteCodes:</td><td>#validResponse.AddressNoteCodes.XmlText#</td></tr> <tr><td>AddressNoteDesc:</td><td>#validResponse.AddressNoteDesc.XmlText#</td></tr> <tr><td>EmailCertainty:</td><td>#validResponse.EmailCertainty.XmlText#</td></tr> <tr><td>EmailQuality:</td><td>#validResponse.EmailQuality.XmlText#</td></tr> <tr><td>EmailCorrected:</td><td>#validResponse.EmailCorrected.XmlText#</td></tr> <tr><td>EmailNoteCodes:</td><td>#validResponse.EmailNoteCodes.XmlText#</td></tr> <tr><td>EmailNoteDesc:</td><td>#validResponse.EmailNoteDesc.XmlText#</td></tr> <tr><td>IPCertainty:</td><td>#validResponse.IPCertainty.XmlText#</td></tr> <tr><td>IPQuality:</td><td>#validResponse.IPQuality.XmlText#</td></tr> <tr><td>IPLocality:</td><td>#validResponse.IPLocality.XmlText#</td></tr> <tr><td>IPAdminArea:</td><td>#validResponse.IPAdminArea.XmlText#</td></tr> <tr><td>IPCountry:</td><td>#validResponse.IPCountry.XmlText#</td></tr> <tr><td>IPNoteCodes:</td><td>#validResponse.IPNoteCodes.XmlText#</td></tr> <tr><td>IPNoteDesc:</td><td>#validResponse.IPNoteDesc.XmlText#</td></tr> <tr><td>Phone1Certainty:</td><td>#validResponse.Phone1Certainty.XmlText#</td></tr> <tr><td>Phone1Quality:</td><td>#validResponse.Phone1Quality.XmlText#</td></tr> <tr><td>Phone1Locality:</td><td>#validResponse.Phone1Locality.XmlText#</td></tr> <tr><td>Phone1AdminArea:</td><td>#validResponse.Phone1AdminArea.XmlText#</td></tr> <tr><td>Phone1NoteCodes:</td><td>#validResponse.Phone1NoteCodes.XmlText#</td></tr> <tr><td>Phone1NoteDesc:</td><td>#validResponse.Phone1NoteDesc.XmlText#</td></tr> <tr><td>BusinessCertainty:</td><td>#validResponse.BusinessCertainty.XmlText#</td></tr> <tr><td>BusinessQuality:</td><td>#validResponse.BusinessQuality.XmlText#</td></tr> <tr><td>BusinessName:</td><td>#validResponse.BusinessName.XmlText#</td></tr> <tr><td>BusinessDomain:</td><td>#validResponse.BusinessDomain.XmlText#</td></tr> <tr><td>BusinessEmail:</td><td>#validResponse.BusinessEmail.XmlText#</td></tr> <tr><td>BusinessNoteCodes:</td><td>#validResponse.BusinessNoteCodes.XmlText#</td></tr> <tr><td>BusinessNoteDesc:</td><td>#validResponse.BusinessNoteDesc.XmlText#</td></tr> </table> <cfif Len(validResponse.InformationComponents) GT 0> <cfif isDefined("validResponse.InformationComponents.InformationComponent.XmlText")> <br><b>Information Components</b> <table width="450" border="1" cellpadding="2" cellspacing="2"> <cfset infoComponent = validResponse.InformationComponents.InformationComponent> <cfloop from ="1" to="#ArrayLen(infoComponent)#" index ="i"> <tr><td>#infoComponent[i].Name.XmlText#</td><td>#infoComponent[i].Value.XmlText#</td></tr> </cfloop> </cfif> </cfif> <cfif Len(validResponse.PhoneContact) GT 0> <br><b>Phone Contacts</b> <table width="450" border="1" cellpadding="2" cellspacing="2"> <cfset phoneContact = validResponse.PhoneContact> <tr><td>Name</td><td>#PhoneContact.Name.XmlText#</td></tr> <tr><td>Address</td><td>#PhoneContact.Address.XmlText#</td></tr> <tr><td>City</td><td>#PhoneContact.City.XmlText#</td></tr> <tr><td>State</td><td>#PhoneContact.State.XmlText#</td></tr> <tr><td>Zip</td><td>#PhoneContact.Zip.XmlText#</td></tr> <tr><td>Name</td><td>#PhoneContact.Name.XmlText#</td></tr> </cfif> </table> </cfoutput> </cfif> <cfcatch> <cfoutput> </br> <tr><td><b>Unable to process request. #cfcatch.message#</b></td></tr> </cfoutput> </cfcatch> </cftry> </cfif>