Language:
<!-- Import the Integr8 Ajax API -->
<!-- NOTE: Get your own API key to use in the following script tag from: -->
<!-- http://www.data-8.co.uk/integr8/Admin/Ajax.aspx -->
<script src="http://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">
</script>
<script type="text/javascript">
function loadIntegr8() {
// Load the Location Integr8 service
data8.load('Location');
}
function FindLocation(licence, postcode) {
/// <param name="licence">string. One of the following values: WebServer, WebClick, InternalUser, SmallUser, Lookup, InternalServer</param>
/// <param name="postcode">string</param>
var location = new data8.location();
location.findlocation(
licence,
postcode,
null,
showFindLocationResult
);
}
function showFindLocationResult(result) {
// Check that the call succeeded, and show the error message if there was a problem.
if (!result.Status.Success) {
alert('Error: ' + result.Status.ErrorMessage);
}
else {
// TODO: Process method results here.
// Results can be extracted from the following fields:
// result.Result
// Contains the position of the requested postcode.
// The position can be extracted from this value in any of three ways:
// 1. Using the Easting and Northing fields, measured in metres east and north
// of the point at 49° N, 2° W.
// 2. Using the GridReference field to get the standard Ordnance Survey grid reference.
// 3. Using the Latitude and Longitude fields to get the location according to
// the selected datum (defaults to WGS84)
}
}
loadIntegr8();
</script>
// NOTE: A reference to the web service must be added in Visual Studio with the URL
// http://webservices.data-8.co.uk/Location.asmx
private void FindLocation(LocationLicence licence, string postcode)
{
// Invoke the web service method.
Location proxy = new Location();
LocationOutput results = proxy.FindLocation("username", "password", licence, postcode, null);
// Check that the call succeeded, and show the error message if there was a problem.
if ((results.Status.Success == false))
{
MessageBox.Show(("Error: " + results.Status.ErrorMessage));
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// result.Result
// Contains the position of the requested postcode.
// The position can be extracted from this value in any of three ways:
// 1. Using the Easting and Northing fields, measured in metres east and north
// of the point at 49° N, 2° W.
// 2. Using the GridReference field to get the standard Ordnance Survey grid reference.
// 3. Using the Latitude and Longitude fields to get the location according to
// the selected datum (defaults to WGS84)
}
}
'NOTE: A reference to the web service must be added in Visual Studio with the URL
'http://webservices.data-8.co.uk/Location.asmx
Private Sub FindLocation(ByVal licence As LocationLicence, ByVal postcode As String)
'Invoke the web service method.
Dim proxy As Location = New Location()
Dim results As LocationOutput = proxy.FindLocation("username", "password", licence, postcode, Nothing)
'Check that the call succeeded, and show the error message if there was a problem.
If (results.Status.Success Is false) Then
MessageBox.Show(("Error: " + results.Status.ErrorMessage))
Else
'TODO: Process method results here.
'Results can be extracted from the following fields:
'result.Result
' Contains the position of the requested postcode.
' The position can be extracted from this value in any of three ways:
' 1. Using the Easting and Northing fields, measured in metres east and north
' of the point at 49° N, 2° W.
' 2. Using the GridReference field to get the standard Ordnance Survey grid reference.
' 3. Using the Latitude and Longitude fields to get the location according to
' the selected datum (defaults to WGS84)
End If
End Sub
Public Sub FindLocation(licence As String, postcode As String)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "http://webservices.data-8.co.uk/recordset.ashx?service=Location&method=FindLocationSimple" &
"&username=your-username" &
"&password=your-password" &
"&licence=" & licence &
"&postcode=" & postcode
If rs.MoveFirst Then
If rs.Fields(0).Name = "Success" And rs.Fields(0).Value = false Then
MsgBox "Error: " & rs.Fields(1)
Else
'TODO: Process method results here.
'All the results are available in the first row in the recordset.
'Results can be extracted from the following fields:
'Result
' Contains the position of the requested postcode.
' The position can be extracted from this value in any of three ways:
' 1. Using the Easting and Northing fields, measured in metres east and north
' of the point at 49° N, 2° W.
' 2. Using the GridReference field to get the standard Ordnance Survey grid reference.
' 3. Using the Latitude and Longitude fields to get the location according to
' the selected datum (defaults to WGS84)
End If
End If
End Sub
// NOTE: The php_soap.dll extension must be enabled in the php.ini file.
function FindLocation($licence, $postcode)
{
$params = array(
"username" => "your-username",
"password" => "your-password",
"licence" => $licence,
"postcode" => $postcode,
"options" => $options
);
$client = new SoapClient("http://webservices.data-8.co.uk/Location.asmx?WSDL");
$result = $client->FindLocation($params);
if ($result->FindLocationResult->Status->Success == 0)
{
echo "Error: " . $result->FindLocationResult->Status->ErrorMessage;
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// $result->FindLocationResult->Result
// Contains the position of the requested postcode.
// The position can be extracted from this value in any of three ways:
// 1. Using the Easting and Northing fields, measured in metres east and north
// of the point at 49° N, 2° W.
// 2. Using the GridReference field to get the standard Ordnance Survey grid reference.
// 3. Using the Latitude and Longitude fields to get the location according to
// the selected datum (defaults to WGS84)
}
}