1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
| '*****************************************************************
'This class was created by the Web Service References Tool 2.0.
'
'Created: 10/24/2007 02:06:40 PM
'
'Description:
'This class is a Visual Basic for Applications class representation of the Web service
'as defined by <a href="http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl" target="_blank">http://ec.europa.eu/taxation_customs...ckVatPort?wsdl</a>.
'
'To Use:
'Dimension a variable as new clsws_checkVatService, and then write code to
'use the methods provided by the class.
'Example:
' Dim ExampleVar as New clsws_checkVatService
' debug.print ExampleVar.wsm_checkVat("Sample Input")
'
'For more information, see Complex Types in Web Service References
'Tool 2.0 Help.
'
'Changes to the code in this class may result in incorrect behavior.
'
'*****************************************************************
'Dimensioning private class variables.
Private sc_checkVatService As SoapClient30
Private Const c_WSDL_URL As String = "http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl"
Private Const c_SERVICE As String = "checkVatService"
Private Const c_PORT As String = "checkVatPort"
Private Const c_SERVICE_NAMESPACE As String = "urn:ec.europa.eu:taxud:vies:services:checkVat"
Private Sub Class_Initialize()
'*****************************************************************
'This subroutine will be called each time the class is instantiated.
'Creates sc_ComplexTypes as new SoapClient30, and then
'initializes sc_ComplexTypes.mssoapinit2 with WSDL file found in
'http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl.
'*****************************************************************
Dim str_WSML As String
str_WSML = ""
Set sc_checkVatService = New SoapClient30
sc_checkVatService.MSSoapInit2 c_WSDL_URL, str_WSML, c_SERVICE, c_PORT, c_SERVICE_NAMESPACE
'Use the proxy server defined in Internet Explorer's LAN settings by
'setting ProxyServer to <CURRENT_USER>
sc_checkVatService.ConnectorProperty("ProxyServer") = "<CURRENT_USER>"
'Autodetect proxy settings if Internet Explorer is set to autodetect
'by setting EnableAutoProxy to True
sc_checkVatService.ConnectorProperty("EnableAutoProxy") = True
End Sub
Private Sub Class_Terminate()
'*****************************************************************
'This subroutine will be called each time the class is destructed.
'Sets sc_ComplexTypes to Nothing.
'*****************************************************************
'Error Trap
On Error GoTo Class_TerminateTrap
Set sc_checkVatService = Nothing
Exit Sub
Class_TerminateTrap:
checkVatServiceErrorHandler ("Class_Terminate")
End Sub
Private Sub checkVatServiceErrorHandler(str_Function As String)
'*****************************************************************
'This subroutine is the class error handler. It can be called from any class subroutine or function
'when that subroutine or function encounters an error. Then, it will raise the error along with the
'name of the calling subroutine or function.
'*****************************************************************
'SOAP Error
If sc_checkVatService.FaultCode <> "" Then
Err.Raise vbObjectError, str_Function, sc_checkVatService.FaultString
'Non SOAP Error
Else
Err.Raise Err.Number, str_Function, Err.Description
End If
End Sub
Public Sub wsm_checkVat(ByRef str_countryCode As String, ByRef str_vatNumber As String, ByRef dtm_requestDate As Date, ByRef bln_valid As Boolean, ByRef str_name As String, ByRef str_address As String)
'*****************************************************************
'Proxy subroutine created from <a href="http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl" target="_blank">http://ec.europa.eu/taxation_customs...ckVatPort?wsdl</a>.
'*****************************************************************
'Error Trap
On Error GoTo wsm_checkVatTrap
sc_checkVatService.checkVat str_countryCode, str_vatNumber, dtm_requestDate, bln_valid, str_name, str_address
Exit Sub
wsm_checkVatTrap:
checkVatServiceErrorHandler "wsm_checkVat"
End Sub |
Partager