Address Detective International C# Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
public partial class ADI_Form : System.Web.UI.Page
{
// A trial license key is not compatible with the backup datacenter.
// The backup url is provided with a production license key.
protected void Page_Load(object sender, EventArgs e)
{
ErrorLabel.Visible = false;
}
protected void btn_Validate_Click(object sender, EventArgs e)
{
try
{
ADI.ResponseObject response = FindBestCountry();
PrintResponse(response);
}
catch (Exception ex)
{
ErrorLabel.Visible = true;
ErrorLabel.Text = ex.Message;
}
}
protected ADI.ResponseObject FindBestCountry()
{
ADI.ResponseObject Response = null;
try
{
using (ADI.SOAPClient Client = new ADI.SOAPClient())
{
// Implement Failover logic here
try
{
Response = Client.FindBestCountry("", "", "", "",
inputAddress1.Text,
inputAddress2.Text,
inputAddress3.Text,
inputAddress4.Text,
inputAddress5.Text,
inputAddress6.Text,
inputAddress7.Text,
inputAddress8.Text,
inputLocality.Text,
inputAdminArea.Text,
inputPostalCode.Text,
inputPhoneNumber.Text,
inputPhoneNumber2.Text,
inputPhoneNumber3.Text,
inputEmail.Text,
inputIPAddress.Text,
inputDomain.Text,
inputLicenseKey.Text);
}
catch (WebException)
{
Client.Endpoint.Address = new System.ServiceModel.EndpointAddress(BackupURL);
Response = Client.FindBestCountry("", "", "", "",
inputAddress1.Text,
inputAddress2.Text,
inputAddress3.Text,
inputAddress4.Text,
inputAddress5.Text,
inputAddress6.Text,
inputAddress7.Text,
inputAddress8.Text,
inputLocality.Text,
inputAdminArea.Text,
inputPostalCode.Text,
inputPhoneNumber.Text,
inputPhoneNumber2.Text,
inputPhoneNumber3.Text,
inputEmail.Text,
inputIPAddress.Text,
inputDomain.Text,
inputLicenseKey.Text);
}
catch (CommunicationException)
{
Client.Abort();
}
catch (TimeoutException)
{
Client.Abort();
}
catch (Exception)
{
Client.Abort();
}
}
}
catch (Exception)
{
// throw;
}
return Response;
}
protected void PrintResponse(ADI.ResponseObject response)
{
DataTable dtProvider = new DataTable();
//Proccess result
//We just output it here but this would be a good place to save data
//to a database or send an email etc.
dtProvider.Columns.Add(new DataColumn("Output", typeof(string)));
dtProvider.Columns.Add(new DataColumn("Values", typeof(string)));
if (response.ContainsKey("CountryDetectionResponse"))
{
ADI.ResultObject ro = response["CountryDetectionResponse"];
//Loop throught he fields
/*
foreach (string Key in ro[0].Keys)
{
dtProvider.Rows.Add(Key, ro[0][Key]);
}
*/
//Or access the fields directly.
dtProvider.Rows.Add("Status", ro[0].ContainsKey("Status") ? ro[0]["Status"] : "");
dtProvider.Rows.Add("TotalScore", ro[0].ContainsKey("TotalScore") ? ro[0]["TotalScore"] : "");
dtProvider.Rows.Add("NotesDesc", ro[0].ContainsKey("NotesDesc") ? ro[0]["NotesDesc"] : "");
dtProvider.Rows.Add("Best_CountryName", ro[0].ContainsKey("Best_CountryName") ? ro[0]["Best_CountryName"] : "");
dtProvider.Rows.Add("Best_CountryISO2", ro[0].ContainsKey("Best_CountryISO2") ? ro[0]["Best_CountryISO2"] : "");
dtProvider.Rows.Add("Best_CountryISO3", ro[0].ContainsKey("Best_CountryISO3") ? ro[0]["Best_CountryISO3"] : "");
dtProvider.Rows.Add("Address_Score", ro[0].ContainsKey("Address_Score") ? ro[0]["Address_Score"] : "");
dtProvider.Rows.Add("Address_CountryName", ro[0].ContainsKey("Address_CountryName") ? ro[0]["Address_CountryName"] : "");
dtProvider.Rows.Add("Address_CountryISO2", ro[0].ContainsKey("Address_CountryISO2") ? ro[0]["Address_CountryISO2"] : "");
dtProvider.Rows.Add("Address_CountryISO3", ro[0].ContainsKey("Address_CountryISO3") ? ro[0]["Address_CountryISO3"] : "");
dtProvider.Rows.Add("Address_AllCountriesFoundISO2", ro[0].ContainsKey("Address_AllCountriesFoundISO2") ? ro[0]["Address_AllCountriesFoundISO2"] : "");
dtProvider.Rows.Add("Phone1_Score", ro[0].ContainsKey("Phone1_Score") ? ro[0]["Phone1_Score"] : "");
dtProvider.Rows.Add("Phone1_CountryName", ro[0].ContainsKey("Phone1_CountryName") ? ro[0]["Phone1_CountryName"] : "");
dtProvider.Rows.Add("Phone1_CountryISO2", ro[0].ContainsKey("Phone1_CountryISO2") ? ro[0]["Phone1_CountryISO2"] : "");
dtProvider.Rows.Add("Phone1_CountryISO3", ro[0].ContainsKey("Phone1_CountryISO3") ? ro[0]["Phone1_CountryISO3"] : "");
dtProvider.Rows.Add("Phone1_AllCountriesFoundISO2", ro[0].ContainsKey("Phone1_AllCountriesFoundISO2") ? ro[0]["Phone1_AllCountriesFoundISO2"] : "");
dtProvider.Rows.Add("Email_Score", ro[0].ContainsKey("Email_Score") ? ro[0]["Email_Score"] : "");
dtProvider.Rows.Add("Email_CountryISO2", ro[0].ContainsKey("Email_CountryISO2") ? ro[0]["Email_CountryISO2"] : "");
dtProvider.Rows.Add("Email_CountryISO3", ro[0].ContainsKey("Email_CountryISO3") ? ro[0]["Email_CountryISO3"] : "");
dtProvider.Rows.Add("Email_AllCountriesFoundISO2", ro[0].ContainsKey("Status") ? ro[0]["Email_AllCountriesFoundISO2"] : "");
}
else
{
if (response.ContainsKey("Error"))
{
ADI.ResultObject roError = response["Error"];
//Loop throught he fields
/*
foreach (string Key in roError[0].Keys)
{
dtProvider.Rows.Add(Key, roError[0][Key]);
}
*/
//Or access the fields directly.
dtProvider.Rows.Add("Type", roError[0].ContainsKey("Type") ? roError[0]["Type"] : "");
dtProvider.Rows.Add("TypeCode", roError[0].ContainsKey("TypeCode") ? roError[0]["TypeCode"] : "");
dtProvider.Rows.Add("Desc ", roError[0].ContainsKey("Desc ") ? roError[0]["Desc "] : "");
dtProvider.Rows.Add("DescCode", roError[0].ContainsKey("DescCode") ? roError[0]["DescCode"] : "");
}
}
ResultGrid.DataSource = new DataView(dtProvider);
ResultGrid.DataBind();
}
}
public partial class ADI_Form : System.Web.UI.Page { const string TrialURL = "https://trial.serviceobjects.com/adi/soap.svc"; // A trial license key is not compatible with the backup datacenter. // The backup url is provided with a production license key. const string BackupURL = "https://trial.serviceobjects.com/adi/soap.svc"; protected void Page_Load(object sender, EventArgs e) { ErrorLabel.Visible = false; } protected void btn_Validate_Click(object sender, EventArgs e) { try { ADI.ResponseObject response = FindBestCountry(); PrintResponse(response); } catch (Exception ex) { ErrorLabel.Visible = true; ErrorLabel.Text = ex.Message; } } protected ADI.ResponseObject FindBestCountry() { ADI.ResponseObject Response = null; try { using (ADI.SOAPClient Client = new ADI.SOAPClient()) { // Implement Failover logic here try { Response = Client.FindBestCountry("", "", "", "", inputAddress1.Text, inputAddress2.Text, inputAddress3.Text, inputAddress4.Text, inputAddress5.Text, inputAddress6.Text, inputAddress7.Text, inputAddress8.Text, inputLocality.Text, inputAdminArea.Text, inputPostalCode.Text, inputPhoneNumber.Text, inputPhoneNumber2.Text, inputPhoneNumber3.Text, inputEmail.Text, inputIPAddress.Text, inputDomain.Text, inputLicenseKey.Text); } catch (WebException) { Client.Endpoint.Address = new System.ServiceModel.EndpointAddress(BackupURL); Response = Client.FindBestCountry("", "", "", "", inputAddress1.Text, inputAddress2.Text, inputAddress3.Text, inputAddress4.Text, inputAddress5.Text, inputAddress6.Text, inputAddress7.Text, inputAddress8.Text, inputLocality.Text, inputAdminArea.Text, inputPostalCode.Text, inputPhoneNumber.Text, inputPhoneNumber2.Text, inputPhoneNumber3.Text, inputEmail.Text, inputIPAddress.Text, inputDomain.Text, inputLicenseKey.Text); } catch (CommunicationException) { Client.Abort(); } catch (TimeoutException) { Client.Abort(); } catch (Exception) { Client.Abort(); } } } catch (Exception) { // throw; } return Response; } protected void PrintResponse(ADI.ResponseObject response) { DataTable dtProvider = new DataTable(); //Proccess result //We just output it here but this would be a good place to save data //to a database or send an email etc. dtProvider.Columns.Add(new DataColumn("Output", typeof(string))); dtProvider.Columns.Add(new DataColumn("Values", typeof(string))); if (response.ContainsKey("CountryDetectionResponse")) { ADI.ResultObject ro = response["CountryDetectionResponse"]; //Loop throught he fields /* foreach (string Key in ro[0].Keys) { dtProvider.Rows.Add(Key, ro[0][Key]); } */ //Or access the fields directly. dtProvider.Rows.Add("Status", ro[0].ContainsKey("Status") ? ro[0]["Status"] : ""); dtProvider.Rows.Add("TotalScore", ro[0].ContainsKey("TotalScore") ? ro[0]["TotalScore"] : ""); dtProvider.Rows.Add("NotesDesc", ro[0].ContainsKey("NotesDesc") ? ro[0]["NotesDesc"] : ""); dtProvider.Rows.Add("Best_CountryName", ro[0].ContainsKey("Best_CountryName") ? ro[0]["Best_CountryName"] : ""); dtProvider.Rows.Add("Best_CountryISO2", ro[0].ContainsKey("Best_CountryISO2") ? ro[0]["Best_CountryISO2"] : ""); dtProvider.Rows.Add("Best_CountryISO3", ro[0].ContainsKey("Best_CountryISO3") ? ro[0]["Best_CountryISO3"] : ""); dtProvider.Rows.Add("Address_Score", ro[0].ContainsKey("Address_Score") ? ro[0]["Address_Score"] : ""); dtProvider.Rows.Add("Address_CountryName", ro[0].ContainsKey("Address_CountryName") ? ro[0]["Address_CountryName"] : ""); dtProvider.Rows.Add("Address_CountryISO2", ro[0].ContainsKey("Address_CountryISO2") ? ro[0]["Address_CountryISO2"] : ""); dtProvider.Rows.Add("Address_CountryISO3", ro[0].ContainsKey("Address_CountryISO3") ? ro[0]["Address_CountryISO3"] : ""); dtProvider.Rows.Add("Address_AllCountriesFoundISO2", ro[0].ContainsKey("Address_AllCountriesFoundISO2") ? ro[0]["Address_AllCountriesFoundISO2"] : ""); dtProvider.Rows.Add("Phone1_Score", ro[0].ContainsKey("Phone1_Score") ? ro[0]["Phone1_Score"] : ""); dtProvider.Rows.Add("Phone1_CountryName", ro[0].ContainsKey("Phone1_CountryName") ? ro[0]["Phone1_CountryName"] : ""); dtProvider.Rows.Add("Phone1_CountryISO2", ro[0].ContainsKey("Phone1_CountryISO2") ? ro[0]["Phone1_CountryISO2"] : ""); dtProvider.Rows.Add("Phone1_CountryISO3", ro[0].ContainsKey("Phone1_CountryISO3") ? ro[0]["Phone1_CountryISO3"] : ""); dtProvider.Rows.Add("Phone1_AllCountriesFoundISO2", ro[0].ContainsKey("Phone1_AllCountriesFoundISO2") ? ro[0]["Phone1_AllCountriesFoundISO2"] : ""); dtProvider.Rows.Add("Email_Score", ro[0].ContainsKey("Email_Score") ? ro[0]["Email_Score"] : ""); dtProvider.Rows.Add("Email_CountryISO2", ro[0].ContainsKey("Email_CountryISO2") ? ro[0]["Email_CountryISO2"] : ""); dtProvider.Rows.Add("Email_CountryISO3", ro[0].ContainsKey("Email_CountryISO3") ? ro[0]["Email_CountryISO3"] : ""); dtProvider.Rows.Add("Email_AllCountriesFoundISO2", ro[0].ContainsKey("Status") ? ro[0]["Email_AllCountriesFoundISO2"] : ""); } else { if (response.ContainsKey("Error")) { ADI.ResultObject roError = response["Error"]; //Loop throught he fields /* foreach (string Key in roError[0].Keys) { dtProvider.Rows.Add(Key, roError[0][Key]); } */ //Or access the fields directly. dtProvider.Rows.Add("Type", roError[0].ContainsKey("Type") ? roError[0]["Type"] : ""); dtProvider.Rows.Add("TypeCode", roError[0].ContainsKey("TypeCode") ? roError[0]["TypeCode"] : ""); dtProvider.Rows.Add("Desc ", roError[0].ContainsKey("Desc ") ? roError[0]["Desc "] : ""); dtProvider.Rows.Add("DescCode", roError[0].ContainsKey("DescCode") ? roError[0]["DescCode"] : ""); } } ResultGrid.DataSource = new DataView(dtProvider); ResultGrid.DataBind(); } }
public partial class ADI_Form : System.Web.UI.Page
   {
       const string TrialURL = "https://trial.serviceobjects.com/adi/soap.svc";
       // A trial license key is not compatible with the backup datacenter.
       // The backup url is provided with a production license key.
       const string BackupURL = "https://trial.serviceobjects.com/adi/soap.svc";
       protected void Page_Load(object sender, EventArgs e)
       {
           ErrorLabel.Visible = false;
       }
       protected void btn_Validate_Click(object sender, EventArgs e)
       {
           try
           {
               ADI.ResponseObject response = FindBestCountry();
               PrintResponse(response);
           }
           catch (Exception ex)
           {
               ErrorLabel.Visible = true;
               ErrorLabel.Text = ex.Message;
           }
       }
       protected ADI.ResponseObject FindBestCountry()
       {
           ADI.ResponseObject Response = null;
  
           try
           {
               using (ADI.SOAPClient Client = new ADI.SOAPClient())
               {
                   // Implement Failover logic here
                   try
                   {
                       Response = Client.FindBestCountry("", "", "", "",
                                                         inputAddress1.Text,
                                                         inputAddress2.Text,
                                                         inputAddress3.Text,
                                                         inputAddress4.Text,
                                                         inputAddress5.Text,
                                                         inputAddress6.Text,
                                                         inputAddress7.Text,
                                                         inputAddress8.Text,
                                                         inputLocality.Text,
                                                         inputAdminArea.Text,
                                                         inputPostalCode.Text,
                                                         inputPhoneNumber.Text,
                                                         inputPhoneNumber2.Text,
                                                         inputPhoneNumber3.Text,
                                                         inputEmail.Text,
                                                         inputIPAddress.Text,
                                                         inputDomain.Text,
                                                         inputLicenseKey.Text);
                   }
                   catch (WebException)
                   {
                       Client.Endpoint.Address = new System.ServiceModel.EndpointAddress(BackupURL);
                       Response = Client.FindBestCountry("", "", "", "",
                                                         inputAddress1.Text,
                                                         inputAddress2.Text,
                                                         inputAddress3.Text,
                                                         inputAddress4.Text,
                                                         inputAddress5.Text,
                                                         inputAddress6.Text,
                                                         inputAddress7.Text,
                                                         inputAddress8.Text,
                                                         inputLocality.Text,
                                                         inputAdminArea.Text,
                                                         inputPostalCode.Text,
                                                         inputPhoneNumber.Text,
                                                         inputPhoneNumber2.Text,
                                                         inputPhoneNumber3.Text,
                                                         inputEmail.Text,
                                                         inputIPAddress.Text,
                                                         inputDomain.Text,
                                                         inputLicenseKey.Text);
                   }
                   catch (CommunicationException)
                   {
                       Client.Abort();
                   }
                   catch (TimeoutException)
                   {
                       Client.Abort();
                   }
                   catch (Exception)
                   {
                       Client.Abort();
                   }
               }
           }
           catch (Exception)
           {
               // throw;
           }
           return Response;
       }
       protected void PrintResponse(ADI.ResponseObject response)
       {
           DataTable dtProvider = new DataTable();
           //Proccess result
           //We just output it here but this would be a good place to save data
           //to a database or send an email etc.
           dtProvider.Columns.Add(new DataColumn("Output", typeof(string)));
           dtProvider.Columns.Add(new DataColumn("Values", typeof(string)));
           if (response.ContainsKey("CountryDetectionResponse"))
           {
               ADI.ResultObject ro = response["CountryDetectionResponse"];
               //Loop throught he fields
               /*
               foreach (string Key in ro[0].Keys)
               {
                   dtProvider.Rows.Add(Key, ro[0][Key]);
               }
               */
                 
               //Or access the fields directly.
               dtProvider.Rows.Add("Status", ro[0].ContainsKey("Status") ? ro[0]["Status"] : "");
               dtProvider.Rows.Add("TotalScore", ro[0].ContainsKey("TotalScore") ? ro[0]["TotalScore"] : "");
               dtProvider.Rows.Add("NotesDesc", ro[0].ContainsKey("NotesDesc") ? ro[0]["NotesDesc"] : "");
               dtProvider.Rows.Add("Best_CountryName", ro[0].ContainsKey("Best_CountryName") ? ro[0]["Best_CountryName"] : "");
               dtProvider.Rows.Add("Best_CountryISO2", ro[0].ContainsKey("Best_CountryISO2") ? ro[0]["Best_CountryISO2"] : "");
               dtProvider.Rows.Add("Best_CountryISO3", ro[0].ContainsKey("Best_CountryISO3") ? ro[0]["Best_CountryISO3"] : "");
               dtProvider.Rows.Add("Address_Score", ro[0].ContainsKey("Address_Score") ? ro[0]["Address_Score"] : "");
               dtProvider.Rows.Add("Address_CountryName", ro[0].ContainsKey("Address_CountryName") ? ro[0]["Address_CountryName"] : "");
               dtProvider.Rows.Add("Address_CountryISO2", ro[0].ContainsKey("Address_CountryISO2") ? ro[0]["Address_CountryISO2"] : "");
               dtProvider.Rows.Add("Address_CountryISO3", ro[0].ContainsKey("Address_CountryISO3") ? ro[0]["Address_CountryISO3"] : "");
               dtProvider.Rows.Add("Address_AllCountriesFoundISO2", ro[0].ContainsKey("Address_AllCountriesFoundISO2") ? ro[0]["Address_AllCountriesFoundISO2"] : "");
               dtProvider.Rows.Add("Phone1_Score", ro[0].ContainsKey("Phone1_Score") ? ro[0]["Phone1_Score"] : "");
               dtProvider.Rows.Add("Phone1_CountryName", ro[0].ContainsKey("Phone1_CountryName") ? ro[0]["Phone1_CountryName"] : "");
               dtProvider.Rows.Add("Phone1_CountryISO2", ro[0].ContainsKey("Phone1_CountryISO2") ? ro[0]["Phone1_CountryISO2"] : "");
               dtProvider.Rows.Add("Phone1_CountryISO3", ro[0].ContainsKey("Phone1_CountryISO3") ? ro[0]["Phone1_CountryISO3"] : "");
               dtProvider.Rows.Add("Phone1_AllCountriesFoundISO2", ro[0].ContainsKey("Phone1_AllCountriesFoundISO2") ? ro[0]["Phone1_AllCountriesFoundISO2"] : "");
               dtProvider.Rows.Add("Email_Score", ro[0].ContainsKey("Email_Score") ? ro[0]["Email_Score"] : "");
               dtProvider.Rows.Add("Email_CountryISO2", ro[0].ContainsKey("Email_CountryISO2") ? ro[0]["Email_CountryISO2"] : "");
               dtProvider.Rows.Add("Email_CountryISO3", ro[0].ContainsKey("Email_CountryISO3") ? ro[0]["Email_CountryISO3"] : "");
               dtProvider.Rows.Add("Email_AllCountriesFoundISO2", ro[0].ContainsKey("Status") ? ro[0]["Email_AllCountriesFoundISO2"] : "");
           }
           else
           {
               if (response.ContainsKey("Error"))
               {
                   ADI.ResultObject roError = response["Error"];
                   //Loop throught he fields
                   /*
                   foreach (string Key in roError[0].Keys)
                   {
                       dtProvider.Rows.Add(Key, roError[0][Key]);
                   }
                   */
                   //Or access the fields directly.
                   dtProvider.Rows.Add("Type", roError[0].ContainsKey("Type") ? roError[0]["Type"] : "");
                   dtProvider.Rows.Add("TypeCode", roError[0].ContainsKey("TypeCode") ? roError[0]["TypeCode"] : "");
                   dtProvider.Rows.Add("Desc   ", roError[0].ContainsKey("Desc ") ? roError[0]["Desc   "] : "");
                   dtProvider.Rows.Add("DescCode", roError[0].ContainsKey("DescCode") ? roError[0]["DescCode"] : "");
               }
           }
           ResultGrid.DataSource = new DataView(dtProvider);
           ResultGrid.DataBind();
       }
   }

Address Detective International Java Code Snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
String CompanyName = request.getParameter("CompanyName");
String FullName = request.getParameter("FullName");
String FirstName = request.getParameter("FirstName");
String LastName = request.getParameter("LastName");
String Address1 = request.getParameter("Address1");
String Address2 = request.getParameter("Address2");
String Address3 = request.getParameter("Address3");
String Address4 = request.getParameter("Address4");
String Address5 = request.getParameter("Address5");
String Address6 = request.getParameter("Address6");
String Address7 = request.getParameter("Address7");
String Address8 = request.getParameter("Address8");
String Locality = request.getParameter("Locality");
String AdminArea = request.getParameter("AdminArea");
String PostalCode = request.getParameter("PostalCode");
String Phone1 = request.getParameter("Phone1");
String Phone2 = request.getParameter("Phone2");
String Phone3 = request.getParameter("Phone3");
String Email = request.getParameter("Email");
String IPAddress = request.getParameter("IPAddress");
String Domain = request.getParameter("Domain");
String LicenseKey = request.getParameter("LicenseKey");
CompanyName = URLEncoder.encode(CompanyName, "UTF-8").replaceAll("+", "%20");
FullName = URLEncoder.encode(FullName, "UTF-8").replaceAll("+", "%20");
FirstName = URLEncoder.encode(FirstName, "UTF-8").replaceAll("+", "%20");
LastName = URLEncoder.encode(LastName, "UTF-8").replaceAll("+", "%20");
Address1 = URLEncoder.encode(Address1, "UTF-8").replaceAll("+", "%20");
Address2 = URLEncoder.encode(Address2, "UTF-8").replaceAll("+", "%20");
Address3 = URLEncoder.encode(Address3, "UTF-8").replaceAll("+", "%20");
Address4 = URLEncoder.encode(Address4, "UTF-8").replaceAll("+", "%20");
Address5 = URLEncoder.encode(Address5, "UTF-8").replaceAll("+", "%20");
Address6 = URLEncoder.encode(Address6, "UTF-8").replaceAll("+", "%20");
Address7 = URLEncoder.encode(Address7, "UTF-8").replaceAll("+", "%20");
Address8 = URLEncoder.encode(Address8, "UTF-8").replaceAll("+", "%20");
Locality = URLEncoder.encode(Locality, "UTF-8").replaceAll("+", "%20");
AdminArea = URLEncoder.encode(AdminArea, "UTF-8").replaceAll("+", "%20");
PostalCode = URLEncoder.encode(PostalCode, "UTF-8").replaceAll("+", "%20");
Phone1 = URLEncoder.encode(Phone1, "UTF-8").replaceAll("+", "%20");
Phone2 = URLEncoder.encode(Phone2, "UTF-8").replaceAll("+", "%20");
Phone3 = URLEncoder.encode(Phone3, "UTF-8").replaceAll("+", "%20");
Email = URLEncoder.encode(Email, "UTF-8").replaceAll("+", "%20");
IPAddress = URLEncoder.encode(IPAddress, "UTF-8").replaceAll("+", "%20");
Domain = URLEncoder.encode(Domain, "UTF-8").replaceAll("+", "%20");
LicenseKey = URLEncoder.encode(LicenseKey, "UTF-8").replaceAll("+", "%20");
SOAP soap = new SOAP();
ISOAP client = soap.getDOTSAddressDetectiveInternational();
ResponseObject addressDetectiveInternational = client.findBestCountry(CompanyName, FullName, FirstName, LastName, Address1, Address2, Address3, Address4, Address5, Address6, Address7, Address8, Locality, AdminArea, PostalCode, Phone1, Phone2, Phone3, Email, IPAddress, Domain, LicenseKey);
List<Response> responses = addressDetectiveInternational.getResponse();
//Loop through response and fields to find the specific you are targeting.
//A helper method couldb ecreated and used to make this part look nicer but
//essentially it would be doing the same thing so we leave it to you to
//make that decision.
for(Response res : responses){
ResultObject resList = res.getValue();
String resultKey = res.getKey();
List<FieldObject> results = resList.getResult();
for(FieldObject result : results){
List<Field> fields = result.getField();
for(FieldObject.Field kvp : fields){
String key = kvp.getKey();
String value = kvp.getValue();
}
}
}
String CompanyName = request.getParameter("CompanyName"); String FullName = request.getParameter("FullName"); String FirstName = request.getParameter("FirstName"); String LastName = request.getParameter("LastName"); String Address1 = request.getParameter("Address1"); String Address2 = request.getParameter("Address2"); String Address3 = request.getParameter("Address3"); String Address4 = request.getParameter("Address4"); String Address5 = request.getParameter("Address5"); String Address6 = request.getParameter("Address6"); String Address7 = request.getParameter("Address7"); String Address8 = request.getParameter("Address8"); String Locality = request.getParameter("Locality"); String AdminArea = request.getParameter("AdminArea"); String PostalCode = request.getParameter("PostalCode"); String Phone1 = request.getParameter("Phone1"); String Phone2 = request.getParameter("Phone2"); String Phone3 = request.getParameter("Phone3"); String Email = request.getParameter("Email"); String IPAddress = request.getParameter("IPAddress"); String Domain = request.getParameter("Domain"); String LicenseKey = request.getParameter("LicenseKey"); CompanyName = URLEncoder.encode(CompanyName, "UTF-8").replaceAll("+", "%20"); FullName = URLEncoder.encode(FullName, "UTF-8").replaceAll("+", "%20"); FirstName = URLEncoder.encode(FirstName, "UTF-8").replaceAll("+", "%20"); LastName = URLEncoder.encode(LastName, "UTF-8").replaceAll("+", "%20"); Address1 = URLEncoder.encode(Address1, "UTF-8").replaceAll("+", "%20"); Address2 = URLEncoder.encode(Address2, "UTF-8").replaceAll("+", "%20"); Address3 = URLEncoder.encode(Address3, "UTF-8").replaceAll("+", "%20"); Address4 = URLEncoder.encode(Address4, "UTF-8").replaceAll("+", "%20"); Address5 = URLEncoder.encode(Address5, "UTF-8").replaceAll("+", "%20"); Address6 = URLEncoder.encode(Address6, "UTF-8").replaceAll("+", "%20"); Address7 = URLEncoder.encode(Address7, "UTF-8").replaceAll("+", "%20"); Address8 = URLEncoder.encode(Address8, "UTF-8").replaceAll("+", "%20"); Locality = URLEncoder.encode(Locality, "UTF-8").replaceAll("+", "%20"); AdminArea = URLEncoder.encode(AdminArea, "UTF-8").replaceAll("+", "%20"); PostalCode = URLEncoder.encode(PostalCode, "UTF-8").replaceAll("+", "%20"); Phone1 = URLEncoder.encode(Phone1, "UTF-8").replaceAll("+", "%20"); Phone2 = URLEncoder.encode(Phone2, "UTF-8").replaceAll("+", "%20"); Phone3 = URLEncoder.encode(Phone3, "UTF-8").replaceAll("+", "%20"); Email = URLEncoder.encode(Email, "UTF-8").replaceAll("+", "%20"); IPAddress = URLEncoder.encode(IPAddress, "UTF-8").replaceAll("+", "%20"); Domain = URLEncoder.encode(Domain, "UTF-8").replaceAll("+", "%20"); LicenseKey = URLEncoder.encode(LicenseKey, "UTF-8").replaceAll("+", "%20"); SOAP soap = new SOAP(); ISOAP client = soap.getDOTSAddressDetectiveInternational(); ResponseObject addressDetectiveInternational = client.findBestCountry(CompanyName, FullName, FirstName, LastName, Address1, Address2, Address3, Address4, Address5, Address6, Address7, Address8, Locality, AdminArea, PostalCode, Phone1, Phone2, Phone3, Email, IPAddress, Domain, LicenseKey); List<Response> responses = addressDetectiveInternational.getResponse(); //Loop through response and fields to find the specific you are targeting. //A helper method couldb ecreated and used to make this part look nicer but //essentially it would be doing the same thing so we leave it to you to //make that decision. for(Response res : responses){ ResultObject resList = res.getValue(); String resultKey = res.getKey(); List<FieldObject> results = resList.getResult(); for(FieldObject result : results){ List<Field> fields = result.getField(); for(FieldObject.Field kvp : fields){ String key = kvp.getKey(); String value = kvp.getValue(); } } }
String CompanyName = request.getParameter("CompanyName");
String FullName = request.getParameter("FullName");
String FirstName = request.getParameter("FirstName");
String LastName = request.getParameter("LastName");
String Address1 = request.getParameter("Address1");
String Address2 = request.getParameter("Address2");
String Address3 = request.getParameter("Address3");
String Address4 = request.getParameter("Address4");
String Address5 = request.getParameter("Address5");
String Address6 = request.getParameter("Address6");
String Address7 = request.getParameter("Address7");
String Address8 = request.getParameter("Address8");
String Locality = request.getParameter("Locality");
String AdminArea = request.getParameter("AdminArea");
String PostalCode = request.getParameter("PostalCode");
String Phone1 = request.getParameter("Phone1");
String Phone2 = request.getParameter("Phone2");
String Phone3 = request.getParameter("Phone3");
String Email = request.getParameter("Email");
String IPAddress = request.getParameter("IPAddress");
String Domain = request.getParameter("Domain");
String LicenseKey = request.getParameter("LicenseKey");
CompanyName = URLEncoder.encode(CompanyName, "UTF-8").replaceAll("+", "%20");
FullName = URLEncoder.encode(FullName, "UTF-8").replaceAll("+", "%20");
FirstName = URLEncoder.encode(FirstName, "UTF-8").replaceAll("+", "%20");
LastName = URLEncoder.encode(LastName, "UTF-8").replaceAll("+", "%20");
Address1 = URLEncoder.encode(Address1, "UTF-8").replaceAll("+", "%20");
Address2 = URLEncoder.encode(Address2, "UTF-8").replaceAll("+", "%20");
Address3 = URLEncoder.encode(Address3, "UTF-8").replaceAll("+", "%20");
Address4 = URLEncoder.encode(Address4, "UTF-8").replaceAll("+", "%20");
Address5 = URLEncoder.encode(Address5, "UTF-8").replaceAll("+", "%20");
Address6 = URLEncoder.encode(Address6, "UTF-8").replaceAll("+", "%20");
Address7 = URLEncoder.encode(Address7, "UTF-8").replaceAll("+", "%20");
Address8 = URLEncoder.encode(Address8, "UTF-8").replaceAll("+", "%20");
Locality = URLEncoder.encode(Locality, "UTF-8").replaceAll("+", "%20");
AdminArea = URLEncoder.encode(AdminArea, "UTF-8").replaceAll("+", "%20");
PostalCode = URLEncoder.encode(PostalCode, "UTF-8").replaceAll("+", "%20");
Phone1 = URLEncoder.encode(Phone1, "UTF-8").replaceAll("+", "%20");
Phone2 = URLEncoder.encode(Phone2, "UTF-8").replaceAll("+", "%20");
Phone3 = URLEncoder.encode(Phone3, "UTF-8").replaceAll("+", "%20");
Email = URLEncoder.encode(Email, "UTF-8").replaceAll("+", "%20");
IPAddress = URLEncoder.encode(IPAddress, "UTF-8").replaceAll("+", "%20");
Domain = URLEncoder.encode(Domain, "UTF-8").replaceAll("+", "%20");
LicenseKey = URLEncoder.encode(LicenseKey, "UTF-8").replaceAll("+", "%20");
  
SOAP soap = new SOAP();
ISOAP client = soap.getDOTSAddressDetectiveInternational();
ResponseObject addressDetectiveInternational = client.findBestCountry(CompanyName, FullName, FirstName, LastName, Address1, Address2, Address3, Address4, Address5, Address6, Address7, Address8, Locality, AdminArea, PostalCode, Phone1, Phone2, Phone3, Email, IPAddress, Domain, LicenseKey);
List<Response> responses = addressDetectiveInternational.getResponse();
 
//Loop through response and fields to find the specific you are targeting.
//A helper method couldb ecreated and used to make this part look nicer but
//essentially it would be doing the same thing so we leave it to you to
//make that decision.
for(Response res : responses){
    ResultObject resList = res.getValue();
    String resultKey = res.getKey();
    List<FieldObject> results = resList.getResult();
    for(FieldObject result : results){
        List<Field> fields = result.getField();
        for(FieldObject.Field kvp : fields){
            String key = kvp.getKey();
            String value = kvp.getValue();
        }
    }
}