Copy link to clipboard
Copied
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:
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.
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 e
...Copy link to clipboard
Copied
Looking very much like a Coldfusion 8 bug. But we shall soldier on.
The error message suggests that Coldfusion might be expecting less than 2 or more than 2 arguments for the checkVat function. This gives me the idea of experimenting with parameter numbers and with the omit attribute.
Test: What about toggling the values of omit between true and false in
<cfinvoke
webservice="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
method="checkVat"
refreshwsdl="yes"
returnvariable="ws_response">
<cfinvokeargument name="countryCode" value="GB" omit="true">
<cfinvokeargument name="vatNumber" value="244155576" omit="false">
</cfinvoke>
<cfset nm = ws_response.getName()>
<cfset addr = ws_response.getAddress()>
<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="#ws_response#"> --->
Copy link to clipboard
Copied
....and we got:
Web service operation checkVat with parameters {vatNumber={244155576},countryCode={GB}} cannot be found.
I've had the chance to try the same experimentation on another server running CF8 from the same network,
and surprisingly (or maybe unsurprisingly) I got the same error.
Those hellish words will resound in my nightmares tonight.
Three days spent trying now, I think I should consider dropping this feature (I probably would have spent less time by checking customer's vat manually as per request!)
Just to know: wich version of CF are you running?
I was already considering an upgrade for other features (but too bad CF8 is no longer considered for upgrading) this could be the final drop...
Copy link to clipboard
Copied
OK. And now this invocation with just one parameter:
<cfset checkVat.countryCode="GB">
<cfset checkVat.vatNumber="244155576">
<cfinvoke
webservice="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
method="checkVat"
refreshwsdl="yes"
returnvariable="ws_response" >
<cfinvokeargument name="checkVat" value="#checkVat#">
</cfinvoke>
<cfset nm = ws_response.getName()>
<cfset addr = ws_response.getAddress()>
<cfoutput>
Name: #nm#<br>
Address: #addr#<br>
</cfoutput>
Copy link to clipboard
Copied
BKBK ha scritto:
OK. And now this invocation with just one parameter:
[.....]
I get this error:
Now I'm on the ride for hotfixes and updates, that's definitely something I should have checked before.
Copy link to clipboard
Copied
fede_ctfd wrote:
BKBK ha scritto:
OK. And now this invocation with just one parameter:
[.....]I get this error:
Now I'm on the ride for hotfixes and updates, that's definitely something I should have checked before.
OK. Let's then get back to basics, and find out what kind of methods the service expects.
<cfset ws = CreateObject("webservice", "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl")>
<cfdump var="#ws#">
What does it say?
Copy link to clipboard
Copied
REALLY interesting approach!
Here comes the first blink of light in days:
object of checkVat.services.vies.taxud.eu.europa.ec.CheckVatBindingStub | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Class Name | checkVat.services.vies.taxud.eu.europa.ec.CheckVatBindingStub | ||||||||||
Methods |
| ||||||||||
Fields |
| ||||||||||
Parent Class |
I'll have to admit I'm not so confident with java definitions...
what about that authentication fields i.e.?
Copy link to clipboard
Copied
Is it expecting 6 different variables?
checkVat(javax.xml.rpc.holders.StringHolder, javax.xml.rpc.holders.StringHolder, org.apache.axis.holders.DateHolder, javax.xml.rpc.holders.BooleanHolder, javax.xml.rpc.holders.StringHolder, javax.xml.rpc.holders.StringHolder)
-string
-string
-date
-boolean
-string
-string
Searching on other forums I've already tried a similar aproach with no success (but I remember gotting an error on date argument, even passing a "now()" or a createdate(xx,xx,xx) and createdatetime(xx,xx,xx,xx:xx:xx) )
The fields should be:
country code
vat number
request date
valid (yes/not)
company name
company address
Copy link to clipboard
Copied
fede_ctfd wrote:
Just to know: wich version of CF are you running?I was already considering an upgrade for other features (but too bad CF8 is no longer considered for upgrading) this could be the final drop...
I am on version 11. One thing you could do is to implement all the ColdFusion 8 updates and hot fixes.
Copy link to clipboard
Copied
BKBK ha scritto:
fede_ctfd wrote:
Just to know: wich version of CF are you running?I was already considering an upgrade for other features (but too bad CF8 is no longer considered for upgrading) this could be the final drop...
I am on version 11. One thing you could do is to implement all the ColdFusion 8 updates and hot fixes.
I've installed cumulative Hotfix3 (others where only minor fixes for specific issues, not related to this problem)
but no luck.
Just discovered that there was an update to 8.01 version but it is now not downloadable from Adobe website (tried to search in every corner, just linking to other spaces, that link to other spaces, that link to the starting point...) only updates for the latest versions are still available. Seems like a lack of not-so-retro-support, that should have taken small amount of disk space to have a complete service (and CF9 is still considered for purchasing upgrades too).
Not sure if I want to find the 8.01 update from other sources, considering the risk that could be harmful software and that could not fix my problem.
My fault not checking updates before, just like... five or six years ago (I remember buying CF8 when it was brand new)
Copy link to clipboard
Copied
fede_ctfd wrote:
Not sure if I want to find the 8.01 update from other sources, considering the risk that could be harmful software and that could not fix my problem.
Wise. Contact Adobe Support. They might be able to help.
Copy link to clipboard
Copied
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... ''
Copy link to clipboard
Copied
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()>
Copy link to clipboard
Copied
fede_ctfd wrote:
Don't know if this is meaningful, but with this code:
response = ws.checkVat("GB","244155576","2014-09-29", 1, "name", "addrs");
With requestDate as defined above,
response = ws.checkVat("GB","244155576",requestDate, True, "name", "addrs");
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
OK, I think I'll try upgrading to a new CF version, thank for all the support.
I'll check your last answer as correct as we've concluded there's no way to make it run on CF8.
Copy link to clipboard
Copied
fede_ctfd wrote:
I think I'll try upgrading to a new CF version
A good idea, in any case
I'll check your last answer as correct as we've concluded there's no way to make it run on CF8.
CF8 has been phased out, so filing a bug report has no use. Nevertheless, our experiments and discussions will help someone else in future.
I thought of one last idea. It is clear that Coldfusion 8 is making the mistake when locally converting the WSDL into a stub.
We could test to see what happens when we first download the WSDL, store it locally, then run it as a local web service. To start with, create a directory, say, VATService. (I have assumed it is directly under the web root. If you create it elsewhere, be sure to modify the code accordingly). The code follows.
<cfset wsdl_url="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl">
<!--- Do a cfhttp GET to obtain the WSDL file--->
<cfhttp url="#wsdl_url#">
<!--- Write the WSDL file as myVATService.wsdl, in the directory /VATService on your server --->
<cffile action="write" file="C:\ColdFusion8\wwwroot\VATService\myVATService.wsdl" output="#cfhttp.filecontent#">
<!--- Invoke the web service locally --->
<cfinvoke
webservice="http://127.0.0.1:8500/VATService/myVATService.wsdl"
method="checkVat"
refreshwsdl="yes"
returnvariable="ws_response">
<cfinvokeargument name="countryCode" value="GB">
<cfinvokeargument name="vatNumber" value="244155576">
</cfinvoke>
<cfset nm = ws_response.getName()>
<cfset addr = ws_response.getAddress()>
<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="#ws_response#"> --->
Copy link to clipboard
Copied
I got these errors:
Unable to read WSDL from URL: http://127.0.0.1:8500/VATService/myVATService.wsdl.
Error: java.net.ConnectException: Connection refused: connect.
or when moving to other directory:
Unable to read WSDL from URL: xxxxxxxxx/myVATService.wsdl.
Error: 401 Unauthorized.
but I didn't play a lot because I just installed CF11 trial version
and.........................
................
CHECKVAT WSDL WORKS FAULTLESSLY!
As we suspected, It is very very probably a CF8 bug.
Can't believe to finally see those vat names with just 2 quick parameters....!
Copy link to clipboard
Copied
The errors imply an issue with folder permissions. In any case, I am glad to hear you got your web service up and running.