SOAP Web Service Get Street Address
Simply Postcode Software ideal for .NET, ColdFusion, Perl, PHP, Java integration plus other Languages/platforms. Postcode finder for SOAP languages with Street Address search.
Street Address Search functionality:
- Postcode is entered
- User presses search button
- Address filled in apart from House Name/Number
- User manually types in House Name/Number, unlike Full Address
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.
Step 1 Sign up for 30 day free trial
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.
Step 2 Add SOAP reference to your project
The following web references give access to our SOAP web service
.NET Web Reference
https://www.SimplyLookupadmin.co.uk/WebService.asmx
WSDL Web Reference
https://www.SimplyLookupadmin.co.uk/WebService.asmx?WSDL
You should add this SOAP reference to your project.
Step 3 Call SOAP Web to get Street Address
The following code will call the SOAP Web Service to get the Street Address for a given a postcode.
Parameters
| Parameter name | Description |
|---|---|
| DataKey | Datakey, which is available when account has been created, under the “DataKey” tab of the online account administrator page. |
| Username | Only needed if for internal postcode address use |
| SearchType | Set to “UK” |
| SearchPrima.Postcode | Postcode to find |
Returns
Returns true if address search completed and General_credits_display_text contains summary of Credits/License status. Else errors reported in General_errormessage.
Example Code
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
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;
}
Where PostcodeWebService is a web reference to: https://www.SimplyLookupadmin.co.uk/WebService.asmx
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.
Step 4 Testing
Final step is to test, to enable easy testing please use our special test postcodes.
Street Address Search - Example Code
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.