Solved

VAT Webservice

Posted on 2006-07-20
12
2,872 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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