Skip to main content
Known Participant
September 27, 2014
Answered

can't get webservice to work - VIES checkVat WSDL

  • September 27, 2014
  • 3 replies
  • 7946 views

I'm trying to incorporate a VAT checking function in my website, for validating entered VAT.
This service is granted by european Vies WSDL service.
No matter what I try, I always get the same error:

Web service operation checkVat with parameters {xx,xxxxxxxxxxx} cannot be found.

This is the last code I tried (maybe the fifth or sixth method experimented),

just straight from the Coldfusion documentation:

<cfscript>

    ws = CreateObject("webservice",

"http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");

    ws.checkVat("xx","xxxxxxxxxxx");

    req = getSOAPRequest(ws);

</cfscript>

<cfdump var="#req#">

<cfset soapreq = GetSOAPRequest(ws)>

<h2>SOAP Request</h2>

<cfdump var="#soapreq#">

<cfset soapresp = GetSOAPResponse(ws)>

<h2>SOAP Response</h2>

<cfdump var="#soapresp#">

Where red x represent country code and VAT number.

I'm about to let down, three days spent in trying and still no luck.
Someone willing to bang his head with mine?

Thanks anyway.

This topic has been closed for replies.
Correct answer BKBK

Still the same (new) error:

Cannot perform web service invocation checkVat.

The fault returned when invoking the web service operation is:

AxisFault

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server

..../etc.

I too think it has to do with Java date format, and I've alredy tried several conversion methods without luck.

Too bad there's not a javacast for datetime format in CF.


I'm making my mind on all the question:

could it be that CF8 uses an old SOAP protocol, and checkVat WSDL interacts with by dealing with 6 variables,

while the current protocol only makes the same job with two?

Maybe there's a magical datetime format that would do the trick, but it's like throwing stones in water and expecting them to bounce back.

I really would consider upgrading to CF10 if that was still available as an option...


I think the error is deeper than just type conversion. For some reason, Coldfusion 8 is messing up the web service definition.

response = ws.checkVat("GB","244155576",requestDate, True, "name", "addrs");

This is unlikely to be correct. In fact, when I run it on Coldfusion 11, where the two-argument function works, I get the error message,

" Web service operation checkVat with parameters {GB,244155576,Tue Sep 30 09:15:45 CEST 2014,True,name,addrs} cannot be found. "


However, looking back with fresh eyes this morning, I found the definitive reason why the 6-argument function won't work anyway. From your result, it returns void.

3 replies

fede_ctfdAuthor
Known Participant
September 29, 2014

Don't know if this is meaningful, but with this code:

   response = ws.checkVat("GB","244155576","2014-09-29", 1, "name", "addrs");

I get a different error:

Cannot perform web service invocation checkVat.

The fault returned when invoking the web service operation is:

AxisFault

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server

faultSubcode:

faultString: INVALID_INPUT

faultActor:

faultNode:

faultDetail:

    {http://xml.apache.org/axis/}stackTrace:INVALID_INPUT

    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)

    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)

    at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)

    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)

    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

    at org.apache.xerces.parsers.XMLP... ''

BKBK
Community Expert
Community Expert
September 29, 2014

I think the ColdFusion 8 engine is making quite a dog's dinner of the web service. ColdFusion 11 defines the method as just checkVat(java.lang.String, java.lang.String).


You could do something like this for the date:

<cfset requestDate= createobject("java", "java.util.Date").init()>

BKBK
Community Expert
Community Expert
September 29, 2014

Remove the meta tag. In fact, the HTML code is unnecessary.

fede_ctfdAuthor
Known Participant
September 29, 2014

code:

<html>

<head>

<title>Untitled Document</title>

</head>

<body>

<cfscript>

    ws = CreateObject("webservice", "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");

   response = ws.checkVat("GB","244155576");

   nm = response.getName();

   addr = response.getAddress();

</cfscript>

<cfoutput>

Name: #nm#<br>

Address: #addr#<br>

</cfoutput>

</body>

</html>

Response:

Web service operation checkVat with parameters {GB,244155576} cannot be found.


BKBK
Community Expert
Community Expert
September 29, 2014

Quite a curious problem. I am trying to reproduce it. If you get a breakthrough, let us know.

BKBK
Community Expert
Community Expert
September 28, 2014

You are practically there already! Just skip all the SOAP bits:

<cfscript>

    ws = CreateObject("webservice", "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");

   response = ws.checkVat("GB","123456789");

   nm = response.getName();

   addr = response.getAddress();

</cfscript>

<cfoutput>

Name: #nm#<br>

Address: #addr#<br>

</cfoutput>

<!--- Uncomment the following line, to see the various methods you can invoke to obtain information the response contains --->

<!--- <cfdump var="#response#"> --->

You certainly would like to know about this previous thread on the same subject.

fede_ctfdAuthor
Known Participant
September 28, 2014

Thank you for the fast and kind reply,

but nope >:(, it isn't still working for me.

At first I've tried to modify my code following your direction, but got the same old error.


Then I tried copy-pasting your code just to be sure nothing was mismatched, and still got the same error:

Web service operation checkVat with parameters {GB,123456789} cannot be found.

Just to investigate more deeply: is this code working for you?
Could it be something wrong on my side, like admin settings or other??

That would be strange, I've used and still use other WSDL services (i.e. for currency conversion) and they work faultless.

(Thank you for the link, I think I saw that other thread during my endless days of internet research on the subject but unfurtunately that didn't do the trick for me)

BKBK
Community Expert
Community Expert
September 29, 2014

You should pass strings as I do, that is, checkVat("xx","yyyyyyyyy") and not checkVat(xx, yyyyyyyyy). In fact, I have just run the following code, and it gives me the details of a well-known bank in the UK:

<cfscript>

    ws = CreateObject("webservice", "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");

   response = ws.checkVat("GB","244155576");

   nm = response.getName();

   addr = response.getAddress();

</cfscript>

<cfoutput>

Name: #nm#<br>

Address: #addr#<br>

</cfoutput>

<!--- Uncomment the following line, to see the various methods you can invoke to obtain information the response contains --->

<!--- <cfdump var="#response#"> --->