Postcode Programming API  SOAP Web Service Advanced search

The SOAP Web Service also supports our advanced/word search when used for Internal Use. This allows the user to enter partial address words to find the full address in the Royal Mail Postcode Address file.

The principle, of searching, is very similar to the Full Address Postcode Finder,  Except it has more parameters.

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

WSDL Web Reference

You should add this SOAP reference to your project.

Step 3 Search for matching data and display

To perform an advanced search, two of the following fields should be filled in with criteria

One or more of the following

Parameter name Description
organistaion Enter most distinctive word of Organisation name. Start of words can be entered by using *
For example “StartOfWord*”
buildingornumber Enter most distinctive word of Building Name or number. Start of words can be entered by using *
For example “StartOfWord*”
street Enter most distinctive word of Street/Road or Avenue Name. Start of words can be entered by using *
For example “StartOfWord*”

And one of the following from a selection list

Parameter name Description
townorvillage Town or village name selected from a list
county County name selected from a list
postarea Start of Postcode (Outer Postcode) selected from a list

The XML list of TownOrVillage, County, and Postcode Outer can be downloaded from URL:

This list should be written to a local store, and displayed for user to select from.

video  Tutorial Video : Show Advanced Search in Action


If recordcount=0 then nothing found

If recordcount=100 then you need to refine the seach query since this query will return a maximum of 100 lines. In which case you should add a line to the list saying “Gone over limit of 100 lines, please refine search....”. To test this set to organistaion=”tesco” and townorvillage=”London”

  Note: Only the first 100 lines of advanced search results are returned. In which case the criteria should be refined.

  This type of search is only available to “Internal use” type of license

Example Code

Several examples are included in the "SOAP" folder of the examples download

The following code is taken from an example and shows the principle which can easily be translated into any other SOAP complient language.:

                    Dim PostcodeSearch As New PostcodeWebService.WebService
Dim SearchPrima As New PL_SearchPrimaRecord
Dim AddressesDataReturned As New PL_AddressesDataReturnedRecord 'Set search criteria, either full Postocde or Two other address fields
With SearchPrima
   .Organistaion = Me.inpOrg.Text
   .BuildingOrNumber = Me.inpBuilding.Text
   .Street = Me.inpStreet.Text
   .TownOrVillage = Me.inpTown.Text
   .County = Me.inpCounty.Text
   .Postcode = Me.inpPostcode.Text
End With 'Set Computer name if for internal Postcode Address Lookup
Dim ComputerName$ = ""
If Microsoft.VisualBasic.Left(Me.InpDataKey.Text, 1) = "I" Then
   ComputerName = Environment.MachineName
End If '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." In simple language this means that each user must be identified by a unique username. 'If the postcode address search is for External use then SET ComputerName = "" 'Do Search, on Postcode or two or more address fields
AddressesDataReturned = PostcodeSearch.SearchForAddress(Me.InpDataKey.Text, ComputerName,
                        "UK", SearchPrima)
If AddressesDataReturned.SearchPerformedWithoutError Then
   'Display results, no major error
   If AddressesDataReturned.ErrorMessage <> "" Then
      MsgBox(AddressesDataReturned.ErrorMessage, MsgBoxStyle.Critical, "Error in Criteria")
      With AddressesDataReturned
         'Show amount of Postocde Lookup credits left
         Me.Text = .CreditsStatusText
         'Remember the URL to buy more Postocde Lookup credits
         LinkToBuyMoreCredits = .BuyMoreCreditsURL
         Me.LinkTOBuyMore.Visible = True          'Put Address data in listview
         Dim x&
         For x = 0 To .LineCount
            'Remeber the ID of each line for retrieval later (step 2)
            Dim itemToAdd As ListViewItem = ListView1.Items.Add(.Lines(x).ID, 0)             'Display addresses found

      End With
      Me.TabControl1.SelectedIndex = 1
   End If Else
   'Display error (Account stuff mostly)
End If

Step 4 Get Address record based on record select

When the users selects a record then simply get it using the sames call as in step 3 of the "Full Address" search