Street Address Search functionality:
The following example calls our server to retrieve Street address for a given postcode. The Street Address is a cut down version of the Full Address, basically it does not contain the Building name or number. Therefore the programmer should allow the user to enter the House Name/Number for the address. These licenses are cheaper than Full Postcode data.
Simply use the "Sign Up for Trial" link at top right of this page to open a trial account. We will then send you a data key, which is used to identify your account, when using the following service.
The following web references give access to our SOAP web service
https://www.SimplyLookupadmin.co.uk/WebService.asmx
https://www.SimplyLookupadmin.co.uk/WebService.asmx?WSDL
You should add this SOAP reference to your project.
The following code will call the SOAP Web Service to get the Street Address for a given a postcode.
Returns true if address search completed and General_credits_display_text contains summary of Credits/License status. Else errors reported in General_errormessage.
VB.NET Dim PostcodeToGet as string = "PE132XQ" Dim PostcodeSearch As New PostcodeWebService.WebService Dim Address As PL_AddressRecord 'Ask for Address by ID Address = PostcodeSearch.SearchForThoroughfareAddress("My DataKey", "TestComputer", "UK", PostcodeToGet ) If Address.AddressRecordGotWithoutError Then 'Display results If Address.ErrorMessage <> "" Then MsgBox(Address.ErrorMessage) 'Process the Address to text field Dim AddressText As String With Address AddressText + = "Line1:" & .Line1 & vbCrLf AddressText + = "Line2:" & .Line2 & vbCrLf AddressText + = "Line3:" & .Line3 & vbCrLf AddressText + = "Town:" & .Town & vbCrLf AddressText + = "Postcode:" & .PostZipcode & vbCrLf AddressText + = "Country:" & .Country & vbCrLf End With Me.TxtAddress.Text = AddressText Else 'Display error (Account stuff mostly, i.e. No License) MsgBox(Address.ErrorMessage) End If
Dim PostcodeToGet as string = "PE132XQ" Dim PostcodeSearch As New PostcodeWebService.WebService Dim Address As PL_AddressRecord 'Ask for Address by ID Address = PostcodeSearch.SearchForThoroughfareAddress("My DataKey", "TestComputer", "UK", PostcodeToGet ) If Address.AddressRecordGotWithoutError Then 'Display results If Address.ErrorMessage <> "" Then MsgBox(Address.ErrorMessage) 'Process the Address to text field Dim AddressText As String With Address AddressText + = "Line1:" & .Line1 & vbCrLf AddressText + = "Line2:" & .Line2 & vbCrLf AddressText + = "Line3:" & .Line3 & vbCrLf AddressText + = "Town:" & .Town & vbCrLf AddressText + = "Postcode:" & .PostZipcode & vbCrLf AddressText + = "Country:" & .Country & vbCrLf End With Me.TxtAddress.Text = AddressText Else 'Display error (Account stuff mostly, i.e. No License) MsgBox(Address.ErrorMessage) End If
Where PostcodeWebService is a web reference to: https://www.SimplyLookupadmin.co.uk/WebService.asmx
C# .NET //Search for Address by Postcode, but returning Thoroughfare/Street data uk.co.simplylookupadmin.www.WebService PostcodeSearch = new uk.co.simplylookupadmin.www.WebService(); uk.co.simplylookupadmin.www.PL_AddressRecord AddressesDataReturned = new uk.co.simplylookupadmin.www.PL_AddressRecord(); string datakey = Request.QueryString["datakey"].ToString(); string PostCode = Request.QueryString["postcode"].ToString(); string userid = Request.QueryString["userid"].ToString(); //Do Search, on Postcode or two or more address fields AddressesDataReturned = PostcodeSearch.SearchForThoroughfareAddress(datakey, userid, "UK", PostCode); if (AddressesDataReturned.AddressRecordGotWithoutError == true) { //Display results, no major error this.TxtResults.Text = AddressesDataReturned.ErrorMessage; string AddressText; AddressText = "Status:" + AddressesDataReturned.CreditsStatusText + "\n" + "\n"; AddressText += "Line1:" + AddressesDataReturned.Line1 + "\n"; AddressText += "Line2:" + AddressesDataReturned.Line2 + "\n"; AddressText += "Line3:" + AddressesDataReturned.Line3 + "\n"; AddressText += "Town:" + AddressesDataReturned.Town + "\n"; AddressText += "County:" + AddressesDataReturned.CountyState + "\n"; AddressText += "PostCode:" + AddressesDataReturned.PostZipCode + "\n"; AddressText += "Country:UK" + "\n"; this.TxtResults.Text = AddressText; } else { //Display error (Account stuff mostly) this.TxtResults.Text = AddressesDataReturned.ErrorMessage; }
//Search for Address by Postcode, but returning Thoroughfare/Street data uk.co.simplylookupadmin.www.WebService PostcodeSearch = new uk.co.simplylookupadmin.www.WebService(); uk.co.simplylookupadmin.www.PL_AddressRecord AddressesDataReturned = new uk.co.simplylookupadmin.www.PL_AddressRecord(); string datakey = Request.QueryString["datakey"].ToString(); string PostCode = Request.QueryString["postcode"].ToString(); string userid = Request.QueryString["userid"].ToString(); //Do Search, on Postcode or two or more address fields AddressesDataReturned = PostcodeSearch.SearchForThoroughfareAddress(datakey, userid, "UK", PostCode); if (AddressesDataReturned.AddressRecordGotWithoutError == true) { //Display results, no major error this.TxtResults.Text = AddressesDataReturned.ErrorMessage; string AddressText; AddressText = "Status:" + AddressesDataReturned.CreditsStatusText + "\n" + "\n"; AddressText += "Line1:" + AddressesDataReturned.Line1 + "\n"; AddressText += "Line2:" + AddressesDataReturned.Line2 + "\n"; AddressText += "Line3:" + AddressesDataReturned.Line3 + "\n"; AddressText += "Town:" + AddressesDataReturned.Town + "\n"; AddressText += "County:" + AddressesDataReturned.CountyState + "\n"; AddressText += "PostCode:" + AddressesDataReturned.PostZipCode + "\n"; AddressText += "Country:UK" + "\n"; this.TxtResults.Text = AddressText; } else { //Display error (Account stuff mostly) this.TxtResults.Text = AddressesDataReturned.ErrorMessage; }
Please note: Section 3.5 of the terms and conditions state: "The Customer, when using the Postcode Lookup service via Web Service, must make sure each user is identified by a unique Computer name, in each call to the Web Service if used internally”. In simple language this means that each user must be identified by a unique computer name, if used by a company employee. In the above example "UserID" was passed as the computer name.
Final step is to test, to enable easy testing please use our special test postcodes.
Simply download the example code. The code is in the "SOAP/VBNET 2010 Thoroughfare" or "SOAP/VBNET 2003 Thoroughfare" directory of our example downloads.
These two examples demonstrate postcode lookup software using Thoroughfare/Street address data.