ExVatcheck.VIESClient.XMLParser (ExVatcheck v0.3.1) View Source
A module for parsing XML responses from VIES client requests into Elixir maps.
Link to this section Summary
Functions
The parse_response/1
function parses the XML response returned by requests to
the checkVatService.
The parse_service/1
function parses the URL of the checkVatService from the
VIES WSDL response.
Link to this section Types
Specs
Link to this section Functions
Specs
The parse_response/1
function parses the XML response returned by requests to
the checkVatService.
When the service is available, the response has the following structure:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<ns2:checkVatResponse xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<ns2:countryCode>BE</countryCode>
<ns2:vatNumber>0829071668</vatNumber>
<ns2:requestDate>2016-01-16+01:00</requestDate>
<ns2:valid>true</valid>
<ns2:name>SPRL BIGUP</name>
<ns2:address>RUE LONGUE 93 1320 BEAUVECHAIN</address>
</ns2:checkVatResponse>
</env:Body>
</env:Envelope>
Sometimes, the VIES service is unavailable (see http://ec.europa.eu/taxation_customs/vies/help.html). In the case that it is not, the response has the following structure:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<env:Fault>
...
</env:Fault>
</env:Body>
</env:Envelope>
If ex_vatcheck is not able to parse either of the above XML responses, the function will return an error tuple.
Specs
The parse_service/1
function parses the URL of the checkVatService from the
VIES WSDL response.
The WSDL has the following structure:
<wsdl:definitions ...>
...
<wsdl:service name="checkVatService">
<wsdl:port name="checkVatPort" binding="impl:checkVatBinding">
<wsdlsoap:address location="https://ec.europa.eu/taxation_customs/vies/services/checkVatService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>