Jump to content
Filipe Alves

Tecla PHC para verificação NIF no VIES

Recommended Posts

Filipe Alves

Boa tarde.

Queria criar uma tecla para verificar no VIES se NIF está activo/inactivo e também permitir a actualização dos dados no PHC de acordo com o VIES

Já tenho a parte xml que verifica corretamente no VIES, mas não consigo relacionar o xml com as variaveis PHC:

Alguem pode ajudar ?
 

* POST- header
*!*    POST /taxation_customs/vies/services/checkVatService HTTP/1.1
*!*    Cache-Control: no-cache
*!*    Connection: Keep-Alive
*!*    Pragma: no-cache
*!*    Content-Type: text/xml; charset="UTF-8"
*!*    User-Agent: SOAP Toolkit 3.0
*!*    SOAPAction: ""
*!*    Content-Length: 630
*!*    Host: ec.europa.eu
Clear


* POST - data
TEXT TO lcEnvelop NOSHOW
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
 <SOAP-ENV:Body>
  <checkVat xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
   <countryCode xmlns:SOAPSDK4="urn:ec.europa.eu:taxud:vies:services:checkVat:types">PT</countryCode>
   <vatNumber xmlns:SOAPSDK5="urn:ec.europa.eu:taxud:vies:services:checkVat:types">502199326</vatNumber>
  </checkVat>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
ENDTEXT

xh = Createobject("Msxml2.XMLHTTP.6.0")
xh.Open ("POST", "https://ec.europa.eu/taxation_customs/vies/services/checkVatService","False")
? xh.ReadyState
If xh.ReadyState # 1
    =Messagebox("I can't open web services",0+16,"Ooh.Serious trouble...")
    xh=.Null.
    Release xh
    Return
Endif

xh.setRequestHeader ("Content-Type", "text/xml; charset=utf-8")
xh.setRequestHeader ("SOAPAction", "https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl")

xh.Send(lcEnvelop)
If (xh.ReadyState <> 4)
    =Messagebox("Error at comunication with WS!",0+16,"Ooh.Serious trouble...")
    This.lcResponse=.F.
    xh=.Null.
    Release xh
Else
    ?xh.responseXML.XML
    xh=.Null.
    Release xh
Endif

 

Share this post


Link to post
Share on other sites
pc.cesar
TEXT TO lcEnvelop NOSHOW
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>    <checkVat xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<countryCode xmlns:SOAP-ENV="urn:ec.europa.eu:taxud:vies:services:checkVat:types">#CLPNCONT#</countryCode>
<vatNumber xmlns:SOAP-ENV="urn:ec.europa.eu:taxud:vies:services:checkVat:types">#CLNCONT#</vatNumber>
</checkVat>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
ENDTEXT

lcEnvelop= Strtran(lcEnvelop,'#CLNCONT#',Alltrim(cl.ncont))
lcEnvelop= Strtran(lcEnvelop,'#CLPNCONT#',Alltrim(cl.pncont))

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.