VIES (VAT Information Exchange System) SOAP requester

Share your advanced PureBasic knowledge/code with the community.
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 543
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

VIES (VAT Information Exchange System) SOAP requester

Post by bbanelli »

Previosuly on PB forum chronicles - couldn't get SOAP request working for VIES. Now I've finally managed to get it done. Was: "SOAP request not working with PB's curl"
  • What is the VAT Information Exchange System (VIES)?
  • It is an electronic means of transmitting information relating to VAT-registration (= validity of VAT-numbers) of companies registered in EU. Furthermore, information relating to (tax exempt) intra-Community supplies between Member States' administrations is also transmitted via VIES.
You can get "WebServices.pbi" from Deluxe0321's post here!

Code: Select all

XIncludeFile("WebServices.pbi")

EnableExplicit

#SOAP_INVALID_INPUT = "The provided CountryCode is invalid or the VAT number is empty."
#SOAP_SERVICE_UNAVAILABLE = "The SOAP service is unavailable, try again later."
#SOAP_MS_UNAVAILABLE = "The Member State service is unavailable, try again later or with another Member State."
#SOAP_TIMEOUT = "The Member State service could not be reach in time, try again later or with another Member Stat."
#SOAP_SERVER_BUSY = "The service can't process your request. Try again latter."

Structure VIESReturn
  countryCode.s
  vatNumber.s
  requestDate.s
  valid.b
  name.s
  address.s
  faultString.s
EndStructure

Declare.s Post(Payload.s, URL.s)
Declare.i CheckVIES(countryCode.s, vatNumber.s, *struct.VIESReturn)

Procedure.s Post(Payload.s, URL.s)
  Protected.i curl, res
  Protected.s CURLData, header
  Protected *header.Curl_Slist
  InitializeStructure(*header, Curl_Slist)
  curl  = curl_easy_init()
  If curl
    curl_easy_setopt(curl, #CURLOPT_VERBOSE, #True)
    curl_easy_setopt(curl, #CURLOPT_URL, str2curl(URLEncoder(URL)))
    curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYPEER, #False)
    curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYHOST, #False)
    header = ~"SOAPAction: \"checkVAT\""
    *header = curl_slist_append(*header, header)
    header = "Content-Type: text/xml;charset=UTF-8"
    *header = curl_slist_append(*header, header)
    curl_easy_setopt(curl, #CURLOPT_HTTPHEADER, *header)
    curl_easy_setopt(curl, #CURLOPT_POST, #True)
    curl_easy_setopt(curl, #CURLOPT_USERAGENT, str2curl(PeekS(curl_version(), -1, #PB_UTF8)))
    curl_easy_setopt(curl, #CURLOPT_POSTFIELDSIZE_LARGE, Len(Payload))
    curl_easy_setopt(curl, #CURLOPT_POSTFIELDS, str2curl(Payload))
    curl_easy_setopt(curl, #CURLOPT_WRITEFUNCTION, @LibCurl_WriteFunction())
    curl_easy_setopt(curl, #CURLOPT_READDATA, @Payload);
    res = curl_easy_perform(curl)
    CURLData = LibCurl_GetData()
    curl_slist_free_all(*header)
    curl_easy_cleanup(curl)
    ProcedureReturn CURLData
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure
Procedure.i CheckVIES(countryCode.s, vatNumber.s, *struct.VIESReturn)
  Protected.s SOAPRequest, SOAPServer, POSTReturn
  Protected.i XML
  Protected *MainNode, *ChildNode, *ChildNode2, *ChildNode3
  SOAPRequest = ~"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
  SOAPRequest + ~"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\""
  SOAPRequest + ~"xmlns:tns1=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\""
  SOAPRequest + ~"xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\""
  SOAPRequest + ~"xmlns:impl=\"urn:ec.europa.eu:taxud:vies:services:checkVat\""
  SOAPRequest + ~"xmlns:apachesoap=\"http://xml.apache.org/xml-soap\" "
  SOAPRequest + ~"xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\""
  SOAPRequest + ~"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
  SOAPRequest + ~"xmlns:wsdlsoap=\"http://schemas.xmlsoap.org/wsdl/soap/\""
  SOAPRequest + ~"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
  SOAPRequest + ~"<SOAP-ENV:Body>"
  SOAPRequest + ~"<tns1:checkVat xmlns:tns1=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\">"
  SOAPRequest + ~"<tns1:countryCode>" + countryCode + "</tns1:countryCode>"
  SOAPRequest + ~"<tns1:vatNumber>" + vatNumber + "</tns1:vatNumber>"
  SOAPRequest + ~"</tns1:checkVat>"
  SOAPRequest + ~"</SOAP-ENV:Body>"
  SOAPRequest + ~"</SOAP-ENV:Envelope>"
  SOAPServer = "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
  POSTReturn = Post(SOAPRequest, SOAPServer)
  XML = ParseXML(#PB_Any, POSTReturn)
  If XML
    If XMLStatus(XML) <> #PB_XML_Success
      MessageRequester("Warning","There was an error processing the XML File.",#MB_ICONERROR)
    Else  
      *MainNode = MainXMLNode(XML)
      *ChildNode = ChildXMLNode(*MainNode)
      While *ChildNode <> 0
        Select GetXMLNodeName(*ChildNode)
          Case "soap:Body"
            *ChildNode2 = ChildXMLNode(*ChildNode)
            Select GetXMLNodeName(*ChildNode2)
              Case "checkVatResponse"
                *ChildNode3 = ChildXMLNode(*ChildNode2)
                While *ChildNode3 <> 0
                  Select GetXMLNodeName(*ChildNode3)
                    Case "countryCode"
                      *struct\countryCode = GetXMLNodeText(*ChildNode3)
                    Case "vatNumber"
                      *struct\vatNumber = GetXMLNodeText(*ChildNode3)
                    Case "requestDate"
                      *struct\requestDate = GetXMLNodeText(*ChildNode3)
                    Case "valid"
                      If GetXMLNodeText(*ChildNode3) = "true"
                        *struct\valid = #True
                      Else
                        *struct\valid = #False
                      EndIf
                    Case "name"
                      *struct\name = GetXMLNodeText(*ChildNode3)
                    Case "address"
                      *struct\address = GetXMLNodeText(*ChildNode3)
                  EndSelect
                  *ChildNode3 = NextXMLNode(*ChildNode3)
                Wend
              Case "soap:Fault"
                *ChildNode3 = ChildXMLNode(*ChildNode2)
                While *ChildNode3 <> 0
                  Select GetXMLNodeName(*ChildNode3)
                    Case "faultstring"
                      Select GetXMLNodeText(*ChildNode3)
                        Case "INVALID_INPUT"
                          *struct\faultString = #SOAP_INVALID_INPUT
                        Case "SERVICE_UNAVAILABLE"
                          *struct\faultString = #SOAP_SERVICE_UNAVAILABLE
                        Case "MS_UNAVAILABLE"
                          *struct\faultString = #SOAP_MS_UNAVAILABLE
                        Case "TIMEOUT"
                          *struct\faultString = #SOAP_TIMEOUT
                        Case "SERVER_BUSY"
                          *struct\faultString = #SOAP_SERVER_BUSY
                      EndSelect
                  EndSelect
                  *ChildNode3 = NextXMLNode(*ChildNode3)
                Wend
            EndSelect
        EndSelect
        *ChildNode = NextXMLNode(*ChildNode)
      Wend
    EndIf
    ProcedureReturn #True
  Else
    ProcedureReturn #False
  EndIf
EndProcedure

Define VATInfo.VIESReturn

CheckVIES("HR", "87932892185", @VATInfo.VIESReturn) ;Valid VAT
ClearStructure(@VATInfo, VIESReturn)
CheckVIES("HR", "00000000000", @VATInfo.VIESReturn) ;Invalid VAT
ClearStructure(@VATInfo, VIESReturn)
CheckVIES("XX", "", @VATInfo.VIESReturn) ;Improper request
ClearStructure(@VATInfo, VIESReturn)
Output wrote:HR
87932892185
2016-07-26+02:00
1
B A N E L L I D.O.O.
P A V L A H A T Z A 23 2, ZAGREB, 10000 ZAGREB

----------------------------------------
HR
00000000000
2016-07-26+02:00
0
---
---

----------------------------------------



0


The provided CountryCode is invalid or the VAT number is empty.
----------------------------------------
Last edited by bbanelli on Tue Jul 26, 2016 7:08 pm, edited 5 times in total.
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: SOAP request not working with PB's curl

Post by Fred »

The libcurl shipped with PB is a stripped down version, which does include all the module available to keep the exe size smaller.
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 543
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

Re: SOAP request not working with PB's curl

Post by bbanelli »

Fred wrote:The libcurl shipped with PB is a stripped down version, which does include all the module available to keep the exe size smaller.
Fred, how could I doubt in you? It was a matter of my lack of comprehension regarding SOAP ways, to say so. IOW, it's working properly and beautifully, as one would expect from PureBasic. ;)

Could you kindly transfer this one on Tips and tricks, since I can now display whole code for VIES (VAT Information Exchange System) gathering (could be of interest to non-EU members as well)?
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: SOAP request not working with PB's curl

Post by Fred »

OK then ! Done :)
thanos
Enthusiast
Enthusiast
Posts: 422
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Re: VIES (VAT Information Exchange System) SOAP requester

Post by thanos »

Hello.
I know it as an old thread, but has anyone the code of

Code: Select all

WebServices.pbi
which bbanelli used in his example?
Regards
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
infratec
Always Here
Always Here
Posts: 6874
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: VIES (VAT Information Exchange System) SOAP requester

Post by infratec »

You don't need this include:

Code: Select all

Procedure.i CheckVIES(countryCode.s, vatNumber.s, *struct.VIESReturn)
  Protected.s SOAPRequest, SOAPServer, POSTReturn
  Protected.i XML
  Protected *MainNode, *ChildNode, *ChildNode2, *ChildNode3
  Protected NewMap Header$()
  Protected.i HTTPRequest
  
  SOAPRequest = ~"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + #CRLF$
  SOAPRequest + ~"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" "
  SOAPRequest + ~"xmlns:tns1=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\" "
  SOAPRequest + ~"xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" "
  SOAPRequest + ~"xmlns:impl=\"urn:ec.europa.eu:taxud:vies:services:checkVat\" "
  SOAPRequest + ~"xmlns:apachesoap=\"http://xml.apache.org/xml-soap\" "
  SOAPRequest + ~"xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" "
  SOAPRequest + ~"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
  SOAPRequest + ~"xmlns:wsdlsoap=\"http://schemas.xmlsoap.org/wsdl/soap/\" "
  SOAPRequest + ~"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + #CRLF$
  SOAPRequest + ~" <SOAP-ENV:Body>" + #CRLF$
  SOAPRequest + ~"  <tns1:checkVat xmlns:tns1=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\">" + #CRLF$
  SOAPRequest + ~"  <tns1:countryCode>" + countryCode + "</tns1:countryCode>" + #CRLF$
  SOAPRequest + ~"  <tns1:vatNumber>" + vatNumber + "</tns1:vatNumber>" + #CRLF$
  SOAPRequest + ~"  </tns1:checkVat>" + #CRLF$
  SOAPRequest + ~" </SOAP-ENV:Body>" + #CRLF$
  SOAPRequest + ~"</SOAP-ENV:Envelope>"
  
  Debug SOAPRequest
  
  SOAPServer = "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
  
  Header$("Content-Type") = "text/xml;charset=UTF-8"
  Header$("SOAPAction") = "checkVAT"
  
  HTTPRequest = HTTPRequest(#PB_HTTP_Post, SOAPServer, SOAPRequest, 0, Header$())
  If HTTPRequest
    If HTTPInfo(HTTPRequest, #PB_HTTP_StatusCode) = "200"
      POSTReturn = HTTPInfo(HTTPRequest, #PB_HTTP_Response)
      Debug #LF$ + POSTReturn + #LF$
    EndIf
    FinishHTTP(HTTPRequest)
  EndIf
    
  ;POSTReturn = Post(SOAPRequest, SOAPServer)
  XML = ParseXML(#PB_Any, POSTReturn)
  If XML
    If XMLStatus(XML) <> #PB_XML_Success
      MessageRequester("Warning","There was an error processing the XML File.",#MB_ICONERROR)
    Else  
      *MainNode = MainXMLNode(XML)
      *ChildNode = ChildXMLNode(*MainNode)
      While *ChildNode <> 0
        Select GetXMLNodeName(*ChildNode)
          Case "soap:Body"
            *ChildNode2 = ChildXMLNode(*ChildNode)
            Select GetXMLNodeName(*ChildNode2)
              Case "checkVatResponse"
                *ChildNode3 = ChildXMLNode(*ChildNode2)
                While *ChildNode3 <> 0
                  Select GetXMLNodeName(*ChildNode3)
                    Case "countryCode"
                      *struct\countryCode = GetXMLNodeText(*ChildNode3)
                    Case "vatNumber"
                      *struct\vatNumber = GetXMLNodeText(*ChildNode3)
                    Case "requestDate"
                      *struct\requestDate = GetXMLNodeText(*ChildNode3)
                    Case "valid"
                      If GetXMLNodeText(*ChildNode3) = "true"
                        *struct\valid = #True
                      Else
                        *struct\valid = #False
                      EndIf
                    Case "name"
                      *struct\name = GetXMLNodeText(*ChildNode3)
                    Case "address"
                      *struct\address = GetXMLNodeText(*ChildNode3)
                  EndSelect
                  *ChildNode3 = NextXMLNode(*ChildNode3)
                Wend
              Case "soap:Fault"
                *ChildNode3 = ChildXMLNode(*ChildNode2)
                While *ChildNode3 <> 0
                  Select GetXMLNodeName(*ChildNode3)
                    Case "faultstring"
                      Select GetXMLNodeText(*ChildNode3)
                        Case "INVALID_INPUT"
                          *struct\faultString = #SOAP_INVALID_INPUT
                        Case "SERVICE_UNAVAILABLE"
                          *struct\faultString = #SOAP_SERVICE_UNAVAILABLE
                        Case "MS_UNAVAILABLE"
                          *struct\faultString = #SOAP_MS_UNAVAILABLE
                        Case "TIMEOUT"
                          *struct\faultString = #SOAP_TIMEOUT
                        Case "SERVER_BUSY"
                          *struct\faultString = #SOAP_SERVER_BUSY
                      EndSelect
                  EndSelect
                  *ChildNode3 = NextXMLNode(*ChildNode3)
                Wend
            EndSelect
        EndSelect
        *ChildNode = NextXMLNode(*ChildNode)
      Wend
    EndIf
    ProcedureReturn #True
  Else
    ProcedureReturn #False
  EndIf
EndProcedure
But it returns an error:
The given SOAPAction checkVAT does not match an operation.
infratec
Always Here
Always Here
Posts: 6874
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: VIES (VAT Information Exchange System) SOAP requester

Post by infratec »

I tracked it down:

Code: Select all

EnableExplicit

#VIES_Valid_request_with_valid_VAT_number = "100"
#VIES_Valid_request_with_an_invalid_VAT_number = "200"
#VIES_Error_INVALID_INPUT = "201"
#VIES_Error_INVALID_REQUESTER_INFO = "202"
#VIES_Error_SERVICE_UNAVAILABLE = "300"
#VIES_Error_MS_UNAVAILABLE = "301"
#VIES_Error_TIMEOUT = "302"
#VIES_Error_VAT_BLOCKED = "400"
#VIES_Error_IP_BLOCKED = "401"
#VIES_Error_GLOBAL_MAX_CONCURRENT_REQ = "500"
#VIES_Error_GLOBAL_MAX_CONCURRENT_REQ_TIME = "501"
#VIES_Error_MS_MAX_CONCURRENT_REQ = "600"
#VIES_Error_MS_MAX_CONCURRENT_REQ_TIME = "601"



#VIES_SOAP_INVALID_INPUT = "The provided CountryCode is invalid or the VAT number is empty."
#VIES_SOAP_SERVICE_UNAVAILABLE = "The SOAP service is unavailable, try again later."
#VIES_SOAP_MS_UNAVAILABLE = "The Member State service is unavailable, try again later or with another Member State."
#VIES_SOAP_TIMEOUT = "The Member State service could not be reach in time, try again later or with another Member Stat."
#VIES_SOAP_SERVER_BUSY = "The service can't process your request. Try again latter."

Structure VIESReturn
  countryCode.s
  vatNumber.s
  requestDate.s
  valid.b
  name.s
  address.s
  faultString.s
EndStructure




Procedure.i CheckVIES(countryCode.s, vatNumber.s, *struct.VIESReturn)
  Protected.s SOAPRequest, SOAPServer, POSTReturn
  Protected.i XML
  Protected *MainNode, *ChildNode, *ChildNode2, *ChildNode3
  Protected NewMap Header$()
  Protected.i HTTPRequest
  
  
  SOAPRequest = ~"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + #CRLF$
  SOAPRequest + ~"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\">" + #CRLF$
  SOAPRequest + ~" <soapenv:Header/>" + #CRLF$
  SOAPRequest + ~" <soapenv:Body>" + #CRLF$
  SOAPRequest + ~"  <urn:checkVat>" + #CRLF$
  SOAPRequest + ~"   <urn:countryCode>" + countryCode + "</urn:countryCode>" + #CRLF$
  SOAPRequest + ~"   <urn:vatNumber>"+ vatNumber + "</urn:vatNumber>" + #CRLF$
  SOAPRequest + ~"  </urn:checkVat>" + #CRLF$
  SOAPRequest + ~" </soapenv:Body>" + #CRLF$
  SOAPRequest + ~"</soapenv:Envelope>"
  
  
  ;Debug SOAPRequest
  
  If Len(vatNumber) = 3
    ;SOAPServer = "https://ec.europa.eu/taxation_customs/vies/checkVatTestService.wsdl"
    SOAPServer = "http://ec.europa.eu/taxation_customs/vies/services/checkVatTestService"
  Else
    ;SOAPServer = "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
    SOAPServer = "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
  EndIf
  
  Header$("Content-Type") = "text/xml; charset=utf-8"
  ;Header$("SOAPAction") = "checkVatService"
  
  HTTPRequest = HTTPRequest(#PB_HTTP_Post, SOAPServer, SOAPRequest, 0, Header$())
  If HTTPRequest
    If HTTPInfo(HTTPRequest, #PB_HTTP_StatusCode) = "200"
      POSTReturn = HTTPInfo(HTTPRequest, #PB_HTTP_Response)
      ;Debug #LF$ + POSTReturn + #LF$
    EndIf
    FinishHTTP(HTTPRequest)
  EndIf
    
  ;POSTReturn = Post(SOAPRequest, SOAPServer)
  XML = ParseXML(#PB_Any, POSTReturn)
  If XML
    If XMLStatus(XML) <> #PB_XML_Success
      MessageRequester("Warning","There was an error processing the XML File.",#MB_ICONERROR)
    Else  
      *MainNode = MainXMLNode(XML)
      *ChildNode = ChildXMLNode(*MainNode)
      While *ChildNode <> 0
        Select GetXMLNodeName(*ChildNode)
          Case "soap:Body"
            *ChildNode2 = ChildXMLNode(*ChildNode)
            Select GetXMLNodeName(*ChildNode2)
              Case "checkVatResponse"
                *ChildNode3 = ChildXMLNode(*ChildNode2)
                While *ChildNode3 <> 0
                  Select GetXMLNodeName(*ChildNode3)
                    Case "countryCode"
                      *struct\countryCode = GetXMLNodeText(*ChildNode3)
                    Case "vatNumber"
                      *struct\vatNumber = GetXMLNodeText(*ChildNode3)
                    Case "requestDate"
                      *struct\requestDate = GetXMLNodeText(*ChildNode3)
                    Case "valid"
                      If GetXMLNodeText(*ChildNode3) = "true"
                        *struct\valid = #True
                      Else
                        *struct\valid = #False
                      EndIf
                    Case "name"
                      *struct\name = GetXMLNodeText(*ChildNode3)
                    Case "address"
                      *struct\address = GetXMLNodeText(*ChildNode3)
                  EndSelect
                  *ChildNode3 = NextXMLNode(*ChildNode3)
                Wend
              Case "soap:Fault"
                *ChildNode3 = ChildXMLNode(*ChildNode2)
                While *ChildNode3 <> 0
                  Select GetXMLNodeName(*ChildNode3)
                    Case "faultstring"
                      Select GetXMLNodeText(*ChildNode3)
                        Case "INVALID_INPUT"
                          *struct\faultString = #VIES_SOAP_INVALID_INPUT
                        Case "SERVICE_UNAVAILABLE"
                          *struct\faultString = #VIES_SOAP_SERVICE_UNAVAILABLE
                        Case "MS_UNAVAILABLE"
                          *struct\faultString = #VIES_SOAP_MS_UNAVAILABLE
                        Case "TIMEOUT"
                          *struct\faultString = #VIES_SOAP_TIMEOUT
                        Case "SERVER_BUSY"
                          *struct\faultString = #VIES_SOAP_SERVER_BUSY
                      EndSelect
                  EndSelect
                  *ChildNode3 = NextXMLNode(*ChildNode3)
                Wend
            EndSelect
        EndSelect
        *ChildNode = NextXMLNode(*ChildNode)
      Wend
    EndIf
    ProcedureReturn #True
  Else
    ProcedureReturn #False
  EndIf
EndProcedure


Define VATInfo.VIESReturn

CheckVIES("HR", "87932892185", @VATInfo.VIESReturn) ;Valid VAT
If VATInfo\valid
  Debug "Valid Request"
Else
  Debug "Invalid Request"
  Debug "Fault: " + VATInfo\faultString
EndIf
Debug VATInfo\requestDate
Debug VATInfo\name
Debug VATInfo\address
Debug ""

ClearStructure(@VATInfo, VIESReturn)
CheckVIES("HR", "00000000000", @VATInfo.VIESReturn) ;Invalid VAT
If VATInfo\valid
  Debug "Valid Request"
Else
  Debug "Invalid Request"
  Debug "Fault: " + VATInfo\faultString
EndIf
Debug VATInfo\requestDate
Debug VATInfo\name
Debug VATInfo\address
Debug ""


ClearStructure(@VATInfo, VIESReturn)
CheckVIES("DE", #VIES_Valid_request_with_valid_VAT_number, @VATInfo.VIESReturn) ;Improper request
If VATInfo\valid
  Debug "Valid Request"
Else
  Debug "Invalid Request"
  Debug "Fault: " + VATInfo\faultString
EndIf
Debug VATInfo\requestDate
Debug VATInfo\name
Debug VATInfo\address
Debug ""

ClearStructure(@VATInfo, VIESReturn)
CheckVIES("DE", #VIES_Error_INVALID_INPUT, @VATInfo.VIESReturn) ;Improper request
If VATInfo\valid
  Debug "Valid Request"
Else
  Debug "Invalid Request"
  Debug "Fault: " + VATInfo\faultString
EndIf
Debug VATInfo\requestDate
Debug VATInfo\name
Debug VATInfo\address
Debug ""
thanos
Enthusiast
Enthusiast
Posts: 422
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Re: VIES (VAT Information Exchange System) SOAP requester

Post by thanos »

@infratec

Thanks a lot!
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
Post Reply