|
Classic ASP
Getting Started with Classic ASP
Using the Microsoft MSXML Component
You will need to download and install the MSXML 4.0 SP2 from Microsoft Downloads. You can also download a copy of the eSortcodeASP.asp file to help get you started.
This example uses the BranchDetails method of the eSortcode BankDetails web service. The following code snippet is for a very simple ASP page that requires you to enter your eSortcode AccountName and GUID and a Sortcode for which you want to retrieve the Branch Details.
When the 'Get Branch Details' button is pressed a number of fields are returned.
<html> <head> <title>Calling a webservice from classic ASP</title> </head> <body> <FORM method=POST name="form1"> Enter your eSortcode Account Name <INPUT type="text" name="texteSortcodeAccountName"><BR> Enter your eSortcodeGUID <INPUT type="text" name="texteSortcodeGUID"><BR> Enter sortcode <INPUT type="text" name="textSortcode"><BR> <BR><BR> <INPUT type="submit" value="Get Branch Details" name="submit1"> <BR><BR> <% If Request.ServerVariables("REQUEST_METHOD") = "POST" Then Dim xmlhttp Dim Fields Dim URL Dim objReturn Dim s URL = "http://ws.esortcode.com/bankdetails.asmx?op=ValidateAccountGetBranchDetails" Fields = "sSortcode=" & Request.Form("textSortcode") & _ "&sUserName=" & Request.Form("texteSortcodeAccountName") & _ "&sGUID=" & Request.Form("texteSortcodeGUID") & "&sIPAddress=" Set xmlhttp = CreateObject("MSXML2.xmlhttp") xmlhttp.Open "POST", URL, False xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" xmlhttp.Send Fields Set objReturn = CreateObject("MSXML2.DOMDocument") objReturn.LoadXml xmlhttp.responseText If objReturn.hasChildNodes Then If objReturn.getElementsByTagName("IsError").Item(0).Text = "true" Then Response.Write objReturn.getElementsByTagName("ErrorMessage").Item(0).Text Else If objReturn.getElementsByTagName("ValidationMessage").Item(0).Text = _ "VALID" Then Response.Write _ objReturn.getElementsByTagName("ValidationMessage").Item(0).Text & "<BR>" Response.Write _ objReturn.getElementsByTagName _ ("GENERALShortBranchTitle").Item(0).Text 'etc 'etc Else Response.Write _ objReturn.getElementsByTagName("ValidationMessage").Item(0).Text End If End If End If End If %> </form> </body> </html> |
|
If you have not already signed-up for an account click here Sign-Up Now. You will receive your Access Codes by email and you will receive 50 free credits. When you have your Access Codes ready you will be able to use them in the above example. You can then incorporate the code into your own ASP pages. The other methods of the eSortcode Web Service can be used in a similar way. For a full technical description of the eSortcode web service and the 5 methods click on the following link Web Service Described. If you have any questions feel free to contact us at the following link Contact Us.
|