Solved

VAT Webservice

Posted on 2006-07-20
12
2,896 Views
Last Modified: 2013-12-24
Hi,

I am trying to use this webservice:

http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl

After a quick glance at the wsdl, I thought this would do it:

<cfinvoke webservice="http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl"
             method="checkVat"
             returnvariable="wsresult"
             timeout="20">
<cfinvokeargument name="countryCode" value="GB">
<cfinvokeargument name="vatNumber" value="12345">
</cfinvoke>

No joy, the parameters arent right, so I tried passing a struct of the values, still no joy.

Can anyone help with reading the webservice and determining what parameters it wants?

BTW, I can only get this far using my CF 7 install, my CF 6.1 install doesnt even want to generate a stub object for the wsdl.

Thanks,
H
0
Comment
Question by:hanneman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
12 Comments
 
LVL 13

Expert Comment

by:usachrisk1983
ID: 17145885
<cfinvoke webservice="http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl" method="checkVat" returnvariable="myReturn">
 <cfinvokeargument name="countryCode" value="001"/>
 <cfinvokeargument name="vatNumber" value="enter_value_here"/>
 <cfinvokeargument name="requestDate" value="enter_value_here"/>
 <cfinvokeargument name="valid" value="enter_value_here"/>
 <cfinvokeargument name="name" value="enter_value_here"/>
 <cfinvokeargument name="address" value="enter_value_here"/>
</cfinvoke>
0
 
LVL 13

Expert Comment

by:usachrisk1983
ID: 17145894
Sorry to post and run, I didn't mean to submit.  After running that with valid values, try <cfdump var="#myReturn#"> to see what type of return you get, and voila.
0
 
LVL 4

Author Comment

by:hanneman
ID: 17145927
hehe, dreamweaver wrote that for you right? ;)

Heres the result:

 Could not perform web service invocation "checkVat".
Here is the fault returned when invoking the web service operation:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.NullPointerException
 faultActor:
 faultNode:
 faultDetail:
      {http://xml.apache.org/axis/}stackTrace:java.lang.NullPointerException
      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(Unk...

0
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 
LVL 13

Expert Comment

by:usachrisk1983
ID: 17145993
Can you show me the code with the values so I can test?
0
 
LVL 4

Author Comment

by:hanneman
ID: 17146124
The actual values dont matter, the web service should simply return an error message if incorrect values are given.
0
 
LVL 4

Author Comment

by:hanneman
ID: 17146594
I ended up going for a java port to cfscript solution:


function new(classname){
                  return createobject("java",arguments.classname);
            }
            
            
            mf = new("javax.xml.soap.MessageFactory").newInstance();      
        smsg = mf.createMessage();
        sp = smsg.getSOAPPart();
        se = sp.getEnvelope();
        body = se.getBody();
       
        //Add a namespace declaration to the envelope
        se.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");        
   
        bodyName = se.createName("checkVat", "nsg", "http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl");
        bodyElement = body.addBodyElement(bodyName);
   
        childName = se.createName("vatNumber");
        stateNm = bodyElement.addChildElement(childName);
        stateNm.addTextNode("1234");
            
            childName = se.createName("countryCode");
        stateNm = bodyElement.addChildElement(childName);
        stateNm.addTextNode("GB");
            
        //Save the message
        smsg.saveChanges();
             
        conn = new("javax.xml.soap.SOAPConnectionFactory").newInstance().createConnection();
     
        response = conn.call(smsg, "http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl");
            
            responseXML = xmlparse(response.getSOAPPart().getAsString());
0
 
LVL 13

Expert Comment

by:usachrisk1983
ID: 17146622
I was wrong about the arguments, the country code and VAT should be sufficient, but I can't get it to work yet either . . .
0
 
LVL 13

Expert Comment

by:usachrisk1983
ID: 17147941
Sorry posted before reading your post.  Did you get it working via JAVA?
0
 
LVL 4

Author Comment

by:hanneman
ID: 17152546
Yep the java ported to cfscript works great, thanks anyway usachrisk1983!
0
 
LVL 13

Expert Comment

by:usachrisk1983
ID: 17153459
Sorry I couldn't help, but glad you got it working :)
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 17185213
Closed, 500 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question