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
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.
Copy link to clipboard
Copied
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)
Copy link to clipboard
Copied
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#"> --->
Copy link to clipboard
Copied
Thank you again for the much appreciated support, but sadly still that doesn't work for me.
I pass the info as strings, exactly as in your example.
Just to be completely sure, I tried copy-pasting again from your reply, and I get:
Glad to know that it is indeed working for someone... but painfully inexplicably why it is not to me ðŸ˜
I use Coldfusion8, maybe something wrong on my "old" version?
Should I check firewall settings on my CF server?
Something admin-side or something else to be initialized on the page?
Anyway, agonizingly grateful for your kind support
Copy link to clipboard
Copied
You may have to refresh the WSDL. Try a different tack, namely
<cfinvoke
webservice="http://ec.europa.eu/taxation_customs/vies/checkVatService.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
Copy-pasted your code again, and got:
Web service operation checkVat with parameters {vatNumber={244155576},countryCode={GB}} cannot be found.
Still no luck. Since it is working for you, I assume something's wrong by my side.
I'm checking firewall settings now, and url filtering... hope to find the right trick.
Copy link to clipboard
Copied
At least, we can now identify a clue. Your setup is apparently passing a struct, hence a complex type, to the service, instead of strings.
Copy link to clipboard
Copied
Yes, only with last example, when data was passed as argument.
After whitelisting, checking admin settings (checkvat is listed in web services), still got same error.
Tried every combination of parameter/string/object/complex or simple, but still no luck.
Tried refreswsdl, no luck.
Don't know where the issue could be.
Copy link to clipboard
Copied
fede_ctfd wrote:
After whitelisting, checking admin settings (checkvat is listed in web services), still got same error.
It may or may not have anything to do with the issue, but you should change the web service name to something other than checkvat. That is the name of the method.
Copy link to clipboard
Copied
Sorry, my bad explaining, it is listed with full weburl of wsdl, as automated listing, I didn't change.
Just to be sure nothing was interfering, I created a blank page only with the code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</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>
But still, painfully, got the same error:
Web service operation checkVat with parameters {GB,244155576} cannot be found.
Now going to lunch, hoping a pause will ease my pain...
Copy link to clipboard
Copied
fede_ctfd wrote:
it is listed with full weburl of wsdl, as automated listing, I didn't change.
What I meant was, change the name of the service in the Coldfusion Administrator to something other than checkvat. Suppose you rename the webservice in the Administrator to xyz. Then you could test with the code,
<cfscript>
ws = CreateObject("webservice", "xyz");
response = ws.checkVat("GB","244155576");
nm = response.getName();
addr = response.getAddress();
</cfscript>
<cfoutput>
Name: #nm#<br>
Address: #addr#<br>
</cfoutput>
Assuming this test fails, you should also test by deleting the web service entry in the Administrator.
Copy link to clipboard
Copied
As for this:
BKBK ha scritto:
fede_ctfd wrote:
it is listed with full weburl of wsdl, as automated listing, I didn't change.
What I meant was, change the name of the service in the Coldfusion Administrator to something other than checkvat. Suppose you rename the webservice in the Administrator to xyz. Then you could test with the code,
I meant that the full name was the weburl, as from automated cf naming system, and not checkVat, like this:
Actions | Web Service Name | WSDL URL | |||
---|---|---|---|---|---|
http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl | http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl |
however, I now changed the name to VIES_vat for testing, and updated the call from the script...
....and still get the same error
Copy link to clipboard
Copied
Is there an intervening method or some other process that is, for example, doing a conversion to JSON?
Copy link to clipboard
Copied
fede_ctfd wrote:
Copy-pasted your code again, and got:
Web service operation checkVat with parameters {vatNumber={244155576},countryCode={GB}} cannot be found.
This suggests a conversion - perhaps AJAX? perhaps to JSON? - somewhere.
Copy link to clipboard
Copied
Remove the meta tag. In fact, the HTML code is unnecessary.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Quite a curious problem. I am trying to reproduce it. If you get a breakthrough, let us know.
Copy link to clipboard
Copied
Now a test to rule out any influence from your Application file. Create a new directory, for testing, and place the above test file in it. Save the following code as the file Application.cfm within the same directory.
<cfapplication name="ws_test"
sessionmanagement="Yes"
setclientcookies="Yes"
sessiontimeout="#createTimeSpan(0,0,20,0)#"
applicationtimeout="#createTimeSpan(1,0,0,0)#">
Run the CFM file.
Copy link to clipboard
Copied
BKBK ha scritto:
Now a test to rule out any influence from your Application file. Create a new directory, for testing, and place the above test file in it. Save the following code as the file Application.cfm within the same directory.
.....
Run the CFM file.
I'm back, just tried your suggestion, to be sure I understood well:
-I created new directory
-placed test_vat.cfm in that directory
-placed above code in an empty application.cfm file on the same directory
-run test_vat.cfm file
...and got the same ol' error:
Web service operation checkVat with parameters {GB,244155576} cannot be found.
Copy link to clipboard
Copied
That's right, with one exception. For exact comparison of our tests, name the file Application.cfm, with capital A.
Copy link to clipboard
Copied
OK renamed to Application.cfm -
but still got the same error.
Tried the refreshwsdl thing again too, just to be sure, but nope.
(meanwhile, thank you for the continuative support)
Copy link to clipboard
Copied
OK. At least, we've got that out of the way.
Copy link to clipboard
Copied
1) Now, what if we take a lesson from the error message, and try this:
<cfset arg.countryCode="GB">
<cfset arg.vatNumber="244155576">
<cfinvoke
webservice="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
method="checkVat"
refreshwsdl="yes"
returnvariable="ws_response" argumentcollection="#arg#">
</cfinvoke>
<cfset nm = ws_response.getName()>
<cfset addr = ws_response.getAddress()>
<cfoutput>
Name: #nm#<br>
Address: #addr#<br>
</cfoutput>
2) Do the error logs provide any more information besides the error message we already know?
Copy link to clipboard
Copied
1) Tried last code, and this is the complete resulting error:
Web service operation checkVat with parameters {VATNUMBER={244155576},COUNTRYCODE={GB}} cannot be found.
The error occurred in C:\xxxxxxxxxxxx\cfm_test\14_piva_test.cfm: line 22
20 : refreshwsdl="yes"
21 :
22 : returnvariable="ws_response" argumentcollection="#arg#">
23 :
24 : </cfinvoke>
Resources: •Check the ColdFusion documentation to verify that you are using the correct syntax.
•Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Referrer
Date/Time 29-Sep-14 05:20 PM
Stack Trace
at cf14_piva_test2ecfm1274206001.runPage(C:\xxxxxxxxxx\cfm_test\14_piva_test.cfm:22)
coldfusion.xml.rpc.ServiceProxy$ServiceMethodNotFoundException: Web service operation checkVat with parameters {VATNUMBER={244155576},COUNTRYCODE={GB}} cannot be found.
at coldfusion.xml.rpc.ServiceProxy.invoke(ServiceProxy.java:147)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2210)
at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:417)
at cf14_piva_test2ecfm1274206001.runPage(C:\xxxxxxxxxxxxxxx\cfm_test\14_piva_test.cfm:22)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:192)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:366)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
2) in log files i've only found this:
Web service operation checkVat with parameters {VATNUMBER={244155576},COUNTRYCODE={GB}} cannot be found. The specific sequence of files included or processed is: C:\xxxxxxxxxx\cfm_test\14_piva_test.cfm, line: 22