|
|
||
|
|
||
|
|
![]() VB for Windows or COM SnippetThis code snippet references the ABAService Web Service only. To reference the ABAExpress Web Service,in the Class_Initialize() Subroutine of your project, change the wsdlLOC value to https://www.lyonsreg.com/webservices/abaexpress/ABAService.asmx?wsdl. '''''''''''''''''''''''''''''''''
'WSDL location
Private wsdlLOC As String
Private Sub Class_Initialize()
On Error GoTo errStop
wsdlLOC = "https://www.lyonsreg.com/webservices/aba/ABAService.asmx?wsdl"
exit_me:
Exit Sub
errStop:
Dim errNumber As Long
Dim errDesc As String
errNumber = Err.Number
errDesc = Err.Description
On Error Resume Next
Err.Raise errNumber, "ABAService::Initialize", errDesc
Resume exit_me
End Sub
'''''''''''''''''''''''''''''''''
'Logon - Logon to the web service.
Public Function Logon(ByVal companyID As Long, ByVal userName As String, ByVal passWord As String) As String
On Error GoTo SoapError
Dim ws As New MSSOAPLib30.SoapClient30
ws.MSSoapInit wsdlLOC
Logon = ws.Logon(companyID, userName, passWord)
Set ws = Nothing
exit_me:
Exit Function
SoapError:
Dim errNumber As Long
Dim errDesc As String
errNumber = Err.Number
errDesc = Err.Description
On Error Resume Next
Err.Raise errNumber, "ABAService::Logon", errDesc
Resume exit_me
End Function
'''''''''''''''''''''''''''''''''
'FindCompanyID - Get the company ID from a wildcard
Public Function FindCompanyID(ByVal companyName As String) As Long
On Error GoTo SoapError
Dim ws As New MSSOAPLib30.SoapClient30
ws.MSSoapInit wsdlLOC
FindCompanyID = CLng(ws.FindCompanyID(companyName))
Set ws = Nothing
exit_me:
Exit Function
SoapError:
Dim errNumber As Long
Dim errDesc As String
errNumber = Err.Number
errDesc = Err.Description
On Error Resume Next
Err.Raise errNumber, "ABAService::Initialize", errDesc
Resume exit_me
End Function
'''''''''''''''''''''''''''''''''
'GetBanksXML - Return list of banks via XML.
Public Function GetBanksXML(ByVal token As String, ByVal aba As String) As String
On Error GoTo SoapError
Dim ws As New MSSOAPLib30.SoapClient30
ws.MSSoapInit wsdlLOC
GetBanksXML = ws.GetBanksXML(token, aba)
Set ws = Nothing
exit_me:
Exit Function
SoapError:
Dim errNumber As Long
Dim errDesc As String
errNumber = Err.Number
errDesc = Err.Description
On Error Resume Next
Err.Raise errNumber, "ABAService::Initialize", errDesc
Resume exit_me
End Function
'''''''''''''''''''''''''''''''''
'GetBanksFullXML - Return list of banks via XML.
Public Function GetBanksFullXML(ByVal token As String, ByVal aba As String) As String
On Error GoTo SoapError
Dim ws As New MSSOAPLib30.SoapClient30
ws.MSSoapInit wsdlLOC
GetBanksFullXML = ws.GetBanksFullXML(token, aba)
Set ws = Nothing
exit_me:
Exit Function
SoapError:
Dim errNumber As Long
Dim errDesc As String
errNumber = Err.Number
errDesc = Err.Description
On Error Resume Next
Err.Raise errNumber, "ABAService::Initialize", errDesc
Resume exit_me
End Function
'''''''''''''''''''''''''''''''
'Go button clicked
Private Sub btnGo_Click()
On Error GoTo myerror
'Hour glass
Screen.MousePointer = vbHourglass
'Call the COM object
Dim service As New LyonsWebServices.ABAService
'Get a token
Dim token As String
token = service.Logon(tbCompany(0).Text, tbUserName(0).Text, tbPassword(0).Text)
'Run the query
Dim xml As String
xml = service.GetBanksFullXML(token, Trim(tbABA(0).Text))
ProcessXML xml
Screen.MousePointer = vbDefault
myexit:
Exit Sub
myerror:
comboBanks.Clear
comboBanks.Enabled = False
Screen.MousePointer = vbDefault
MsgBox Err.Description, vbCritical, "Error"
End Sub
'''''''''''''''''''''''''''''''
'Process XML
Private Sub ProcessXML(ByVal xml As String)
comboBanks.Clear
Dim xmlDoc As New DOMDocument40
xmlDoc.loadXML (xml)
Dim nodeList As IXMLDOMNodeList
Dim node As IXMLDOMNode
Set nodeList = xmlDoc.selectNodes("//InstitutionName[@type='M']")
For Each node In nodeList
comboBanks.AddItem (node.Text)
Next
comboBanks.Enabled = True
comboBanks.ListIndex = 0
btnClear.Enabled = True
End Sub
Sample Application To download a sample Visual Basic 6.0 application project, click the link below:
Other Sample Code Snippets
Complete source code for the above sample applications and other platform variations is available upon request. Contact us for more information. © 2003-2007 Lyons Commercial Data
Products | Login | Support | Link to Us | Partners | Events | About Lyons | Contact Us |
|