Solved

VAT Webservice

Posted on 2006-07-20
12
2,895 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
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 
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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

729 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