Solved

VAT Webservice

Posted on 2006-07-20
12
2,856 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
  • 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
 
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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now