ExVatcheck v0.1.3 ExVatcheck.VIESClient.XMLParser 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
Link to this type
response() View Source
Link to this section Functions
Link to this function
parse_response(response_body) View Source
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:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<checkVatResponse xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<countryCode>BE</countryCode>
<vatNumber>0829071668</vatNumber>
<requestDate>2016-01-16+01:00</requestDate>
<valid>true</valid>
<name>SPRL BIGUP</name>
<address>RUE LONGUE 93 1320 BEAUVECHAIN</address>
</checkVatResponse>
</soap:Body>
</soap: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:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
...
</soap:Fault>
</soap:Body>
</soap:Envelope>
Link to this function
parse_service(wsdl_response) View Source
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="http://ec.europa.eu/taxation_customs/vies/services/checkVatService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>