Integration into your existing systems
The ability to connect to Streetwise Addressing from within our main product, alms.NET, and from our previous version, Visual Alms, is included in the latest releases of those products.
For any other system including Microsoft Access or Websites it is necessary to add the appropriate code
As Streetwise Addressing is a web service all the hassle of updates etc. is dealt with by us. You can just call our service over the web from anywhere in the World.
This also means that you do not have to host and maintain any additional
software or hardware.
The process is simple. Pass your search term (eg. "SW11 3UF"), and your licence key to our web service and process the results as appropriate for your application or web site.
Code samples
C# code sample
// Create the web request , passing the URL and licence Key for Streetwise
HttpWebRequest request = WebRequest.Create(string.Concat(StreetwiseURL, "/Addresses/", this.SearchBox.Text.Trim(), "/", StreetwiseLicenceKey)) as HttpWebRequest;
// Get response
XmlDocument results = new XmlDocument();
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
results.Load(reader);
}
}
// Add results to AddressList ASP.Net Combo Box
this.AddressList.Items.Clear();
foreach (XmlNode node in results.SelectNodes("//FormattedAddress"))
{
this.AddressList.Items.Add(node.InnerText);
}
VB.NET code sample
' Create the web request , passing the URL and licence Key for Streetwise
Dim request As HttpWebRequest = TryCast(WebRequest.Create(String.Concat(StreetwiseURL, "/Addresses/", Me.SearchBox.Text.Trim(), "/", StreetwiseLicenceKey)), HttpWebRequest)
' Get response
Dim results As New XmlDocument()
Using response As HttpWebResponse = TryCast(request.GetResponse(), HttpWebResponse)
' Get the response stream
Using reader As New StreamReader(response.GetResponseStream())
results.Load(reader)
End Using
End Using
' Add results to AddressList ASP.Net Combo Box
Me.AddressList.Items.Clear()
For Each node As XmlNode In results.SelectNodes("//FormattedAddress")
Me.AddressList.Items.Add(node.InnerText)
Next
Visual Foxpro code sample
* JcURL is the Streetwise URL
* JcKey is the Streetwise Licence Key
* This puts the formatted addresses into an array and tests for bad calls
IF LEFT(JcURL,1) <> "/"
JcURL = JcURL + "/"
ENDIF
JcURL = JcURL + "Addresses?search=" + ALLTRIM(LcSrchAddExp) + "&key=" + JcKey
*
* Set up some error handling variables
*
PRIVATE llError, lcErrorHandler
llError = .F.
lcErrorHandler = ON("ERROR")
ON ERROR llError = .T.
JoXMLHTTP=CREATEOBJECT("MSXML2.XMLHTTP")
JoXMLHTTP.Open('GET',JcURL ,.F.)
JoXMLHTTP.Send()
ON ERROR &lcErrorHandler
IF llError = .T.
*Bad URL
=MessageBox("You have supplied an invalid URL"+chr(13)+chr(10)+"for WF Streetwise Addressing.")
Return .F.
ENDIF
IF JoXMLHTTP.status = 401
*401 - Licence Key is Invalid
=MessageBox("You have supplied an invalid licence key "+chr(13)+chr(10)+"for WF Streetwise Addressing.")
Return .F.
ENDIF
IF JoXMLHTTP.status = 403
*403 - Client Access Licenses exceeded
=MessageBox("You have exceeded your available user licences"+chr(13)+chr(10)+"for WF Streetwise Addressing.")
Return .F.
ENDIF
IF JoXMLHTTP.status = 402
*402 - Client Purchased Clicks Exceeded
=MessageBox("You have exceeded your available number of searches"+chr(13)+chr(10)+"for WF Streetwise Addressing.")
Return .F.
ENDIF
IF JoXMLHTTP.status <> 200
* Some other Error Occured
=MessageBox("Unable to connect"+chr(13)+chr(10)+"to WF Streetwise addressing.")
Return .F.
ENDIF
ON ERROR llError = .T.
JcPage=JoXMLHTTP.responseText
JoXML = CREATEOBJECT("Microsoft.XMLDOM")
JoXML.loadXML(JcPage)
JoNodeList = JoXML.documentElement.selectNodes("//Address")
ON ERROR &lcErrorHandler
IF llError = .T.
*Probably malformed XML
=MessageBox("Unexpected results from WF Streetwise addressing.")
Return .F.
ENDIF
*-
JnCount = JoNodeList.length
IF JnCount <= 0
RETURN .F.
ENDIF
LnIndex = 1
DIME LaList[LnIndex, 1]
FOR JnI = 0 TO JnCount - 1
JoItem = JoNodeList.item(JnI)
DIME LaList[LnIndex, 1]
LaList[LnIndex,1] = JoItem.selectSingleNode("FormattedAddress").text
LnIndex = LnIndex + 1
ENDFOR
RETURN .T.