How to access service from EU (vies)

Hi,

I’m struggling to get a result from the VIES service of the EU. It’s a public SOAP service to validate European VAT numbers.
When I use the Delphi WSDL importer, it’s pretty straight forward. The RO WSDL importer on the other hand is rather difficult. I don’t succeed in sending a correct message using a TROIndyHTTP channel and a SOAP message.
I’ve already tried a lot of possible combinations of options but no success…
AFAICS the countrycode and vatnumber must be ‘namespaced’ but they are not.

What options do I need to set to send a correct formatted request to this service?
The service WSDL is located here ( https://ec.europa.eu/taxation_customs/vies/checkVatTestService.wsdl)

Request:

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:HNS="http://tempuri.org/" 
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
        <ROClientIDHeader SOAP-ENV:mustUnderstand="0" xmlns="http://tempuri.org/">
           <ID>{DF7F824E-8DBD-4E2C-B2D1-34CB247D53A1}</ID>
        </ROClientIDHeader>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body xmlns:ro="urn:ec.europa.eu:taxud:vies:services:checkVat">
      <v1:checkVat xmlns:v1="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
        <countryCode>BE</countryCode>
        <vatNumber>0123456789</vatNumber>
     </v1:checkVat>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Result:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
  <soap:Fault>
    <faultcode>soap:Client</faultcode>
    <faultstring>Unmarshalling Error: unexpected element (uri:"", local:"countryCode"). Expected elements are &lt;{urn:ec.europa.eu:taxud:vies:services:checkVat:types}vatNumber>,&lt;{urn:ec.europa.eu:taxud:vies:services:checkVat:types}countryCode> 
    </faultstring>
  </soap:Fault>
</soap:Body>
</soap:Envelope>

Pls advise…
This is a public service, so it’s easy to test (it would take longer for me to zip a test, than for you to make one ;-))

Regards,

Filip.

The test-service seems unavailable.
Testing can be done with http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl (same WSDL other URL)

I temporarily solved this problem with the use of StringReplace (in the stream), but that might not be definite the solution.

Regards,
Filip.

  Txt := StringReplace(Txt,'<countryCode>','<v1:countryCode>', [rfReplaceAll]);
  Txt := StringReplace(Txt,'</countryCode>','</v1:countryCode>', [rfReplaceAll]);
  Txt := StringReplace(Txt,'<vatNumber>','<v1:vatNumber>', [rfReplaceAll]);
  Txt := StringReplace(Txt,'</vatNumber>','</v1:vatNumber>', [rfReplaceAll]);

Hi,

pls launch Service Builder, select checkVat method, edit it’s attributes and remove inputchildrennamespace and outputchildrennamespace attributes:


after this, this service will work as expected:

Note: you may need to remove these attributes from all methods of this service