There are three steps to integrating the Phone Verification API into your Visual Studio C# project.
1. Create an account.
Sign up for an account. When you register you will receive a license key to send messages from. You will need this to use the API.
2. Add a web service reference to your project.
In order to call the Phone Verification API, you will need to create a project with a web service reference.
Start by creating a new Console App project in Visual Studio. Then, in the Solution Explorer, right click on your project and select Add > Service Reference….
Visual Studio will open an “Add service reference” dialog. Select WCF Web Service and click the Next button.
In the URI field, type in the URL for the service description file: https://ws.esendex.us/phoneverify/phoneverify.asmx?wsdl. Then click the Go button.
Once the wizard has successfully contacted the Phone Verification service, the service will be shown below the URL.
Change the Namespace to something appropriate for your project. Let’s call it WSDL.
Click the Next button. Visual Studio will offer some options for customizing the service, but you can leave these as default.
The wizard will add the service to your project’s service references (as shown).
3. Verify a phone number.
You can use the CheckPhoneNumber
method to verify a phone number. Add the displayed code to your new file.
Replace the licenseKey
value with your account’s license key.
using WSDL;
var client = new PhoneVerifySoapClient(PhoneVerifySoapClient.EndpointConfiguration.PhoneVerifySoap);
var phoneNumber = "17575449510";
var licenseKey = "00000000-0000-0000-0000-000000000000";
var response = await client.CheckPhoneNumberAsync(phoneNumber, licenseKey);
Console.WriteLine("Company: " + (string.IsNullOrEmpty(response.Company) ? "No Information Found" : response.Company));
Console.WriteLine("Valid: " + response.Valid);
Console.WriteLine("Use: " + (string.IsNullOrEmpty(response.Use) ? "No Information Found" : response.Use));
Console.WriteLine("State: " + (string.IsNullOrEmpty(response.State) ? "No Information Found" : response.State));
Console.WriteLine("Switch: " + (string.IsNullOrEmpty(response.Switch) ? "No Information Found" : response.Switch));
Console.WriteLine("RC: " + (string.IsNullOrEmpty(response.RC) ? "No Information Found" : response.RC));
Console.WriteLine("OCN: " + (string.IsNullOrEmpty(response.OCN) ? "No Information Found" : response.OCN));
Console.WriteLine("Original Number: " + (string.IsNullOrEmpty(response.OriginalNumber) ? "No Information Found" : response.OriginalNumber));
Console.WriteLine("Clean Number: " + (string.IsNullOrEmpty(response.CleanNumber) ? "No Information Found" : response.CleanNumber));
Console.WriteLine("Switch Name: " + (string.IsNullOrEmpty(response.SwitchName) ? "No Information Found" : response.SwitchName));
Console.WriteLine("Switch Type: " + (string.IsNullOrEmpty(response.SwitchType) ? "No Information Found" : response.SwitchType));
Console.WriteLine("Country: " + (string.IsNullOrEmpty(response.Country) ? "No Information Found" : response.Country));
Console.WriteLine("CLLI: " + (string.IsNullOrEmpty(response.CLLI) ? "No Information Found" : response.CLLI));
Console.WriteLine("Prefix Type: " + (string.IsNullOrEmpty(response.PrefixType) ? "No Information Found" : response.PrefixType));
Console.WriteLine("LATA: " + (string.IsNullOrEmpty(response.LATA) ? "No Information Found" : response.LATA));
Console.WriteLine("SMS: " + (string.IsNullOrEmpty(response.sms) ? "No Information Found" : response.sms));
Console.WriteLine("Email: " + (string.IsNullOrEmpty(response.Email) ? "No Information Found" : response.Email));
Console.WriteLine("Date Assigned: " + (string.IsNullOrEmpty(response.AssignDate) ? "No Information Found" : response.AssignDate));
Console.WriteLine("Telecom City: " + (string.IsNullOrEmpty(response.TelecomCity) ? "No Information Found" : response.TelecomCity));
Console.WriteLine("Telecom County: " + (string.IsNullOrEmpty(response.TelecomCounty) ? "No Information Found" : response.TelecomCounty));
Console.WriteLine("Telecom State: " + (string.IsNullOrEmpty(response.TelecomState) ? "No Information Found" : response.TelecomState));
Console.WriteLine("Telecom ZIP: " + (string.IsNullOrEmpty(response.TelecomZip) ? "No Information Found" : response.TelecomZip));
Console.WriteLine("Time Zone: " + (string.IsNullOrEmpty(response.TimeZone) ? "No Information Found" : response.TimeZone));
Console.WriteLine("Latitude: " + (string.IsNullOrEmpty(response.Lat) ? "No Information Found" : response.Lat));
Console.WriteLine("Longitude: " + (string.IsNullOrEmpty(response.Long) ? "No Information Found" : response.Long));
Console.WriteLine("Wireless: " + response.Wireless);
Run the project. Visual Studio will open a debug console. The console will display the results of the phone number verification.
Company: LEVEL 3 COMMUNICATIONS, LLC -
Valid: True
Use: Assigned to a code holder for normal use.
State: VA
Switch: No Information Found
RC: PARKSLEY
OCN: 8825
Original Number: 17575449510
Clean Number: 7575449510
Switch Name: NORFOLK
Switch Type: No Information Found
Country: United States
CLLI: CHSKVAAYDS0
Prefix Type: CLEC - (Competitive Local Exchange Carrier)
LATA: 252
SMS: CLEC - (Competitive Local Exchange Carrier)
Email: No Information Found
Date Assigned: Unknown
Telecom City: Chesapeake
Telecom County: No Information Found
Telecom State: VA
Telecom ZIP: 23324
Time Zone: EST
Latitude: No Information Found
Longitude: No Information Found
Wireless: False