DreamT has asked for the wisdom of the Perl Monks concerning the following question:

Hi!

A while ago I used stubmaker.pl to generate a stub for the VIES webservice (for checking vat-numbers). It worked great then. However, they changed something a while ago, and now the wsdl definition seems incorrect/or the stubmaker isn't able to read it correctly. I've fooled around with namespaces and datatypes, but can't get it to work.

The wsdl link is: http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl , and I want to run the checkVat-service (which takes countrycode and vat-number as arguments).

Anyone who have any ideas about this?

Replies are listed 'Best First'.
Re: checkVat - SOAP::Lite
by Utilitarian (Vicar) on May 04, 2011 at 13:14 UTC
    stubmaker http://ec.europa.eu/taxation_customs/vies/checkVatService. +wsdl -d vatNumbers/ -v Writing stub files... $ ls vatNumbers/ checkVatService.pm
    • How is it not working for you?
    • Does it fail to call the service?
    • Does it output a set of methods different to those you previously used?
    • In other words, could you describe the problem slightly better?

    print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
      Sorry for that:-)
      I was hoping that someone would do the same procedure as me to reproduce the problem.
      Anyway, the stubmaker creates the pm file correctly. When I call the webservice I get a message that i'm using the wrong namespace. After changing it to the proposed namespace, the webservice gives me a quite strange output.


      It looks like some kind of exception is throwed.
      (request) SOAP::Transport::HTTP::Client::send_receive: POST http://ec.europa.eu/ +taxation_customs/vies/services/checkVatService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 777 Content-Type: text/xml; charset=utf-8 SOAPAction: "" <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:wsdlsoap="h +ttp://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.ap +ache.org/xml-soap" soap:encodingStyle="http://schemas.xmlsoap.org/soa +p/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" x +mlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types" xmlns +:impl="urn:ec.europa.eu:taxud:vies:services:checkVat" xmlns:wsdl="htt +p://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLS +chema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encodi +ng/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><tns1:ch +eckVat><countryCode xsi:type="xsd:string">SE</countryCode><vatNumber +xsi:type="xsd:string">12345678</vatNumber></tns1:checkVat></soap:Body +></soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Ser +ver Error Connection: close Date: Wed, 04 May 2011 13:48:47 GMT Content-Type: text/xml; charset=utf-8 Client-Date: Wed, 04 May 2011 13:48:51 GMT Client-Peer: 147.67.119.3:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked (response) <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv= +"http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fa +ult><faultcode>soapenv:Server</faultcode><faultstring>unknown</faults +tring><detail><Exception>org.apache.axis2.AxisFault at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at cec.taxud.fiscalis.vies.viesweb.api.CheckVatServiceMessageRecei +verInOut.invokeBusinessLogic(CheckVatServiceMessageReceiverInOut.java +:83) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeB +usinessLogic(AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(Abst +ractMessageReceiver.java:100) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPP +ostRequest(HTTPTransportUtils.java:275) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet. +java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at cec.taxud.fiscalis.vies.viesweb.web.servlet.Axis2FilterServlet. +service(Axis2FilterServlet.java:49) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationActi +on.run(ServletStubImpl.java:1072) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servlet +StubImpl.java:465) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:2 +8) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainI +mpl.java:27) at cec.taxud.fiscalis.vies.viesweb.api.CheckVatServiceHTTPFilter.d +oFilter(CheckVatServiceHTTPFilter.java:172) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainI +mpl.java:27) at cec.taxud.fiscalis.vies.viesweb.util.EncodingFilter.doFilter(En +codingFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainI +mpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocatio +nAction.run(WebAppServletContext.java:6987) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authen +ticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager +.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(We +bAppServletContext.java:3892) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletReq +uestImpl.java:2766) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183) Caused by: java.lang.NullPointerException at cec.taxud.fiscalis.vies.viesweb.api.ViesWebApi.checkVatRequest( +ViesWebApi.java:39) at cec.taxud.fiscalis.vies.viesweb.api.CheckVatServiceSkeleton.che +ckVat(CheckVatServiceSkeleton.java:42) at cec.taxud.fiscalis.vies.viesweb.api.CheckVatServiceMessageRecei +verInOut.invokeBusinessLogic(CheckVatServiceMessageReceiverInOut.java +:48) ... 23 more </Exception></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope +>
        use checkVatService; use SOAP::Lite +trace => qw( debug ); my $validity = new checkVatService; $validity->readable(1); $validity->want_som(1); $response = $validity->checkVat("IE" , "1234567890");
        Throws the namespace error for me also. At this point I'd be inclined to contact their admin and mention that the wsdl file for the service is incorrect and supply the exception thrown. However in the spirit of enquiry I changed the xmlns and added the parameters
        SOAP::Data->new(name => 'requesterCountryCode', type => 'xsd:string', + attr => {}), SOAP::Data->new(name => 'requesterVatNumber', type => 'xsd:string', a +ttr => {}),
        just to see if they had become required in order to prevent abuse (see their demonstration app http://ec.europa.eu/taxation_customs/vies/ ) however no joy, so we now have an unknown uncaught NullPointer with no hints in the message string, rather than second guess their entire application contact their admin.

        Not only does it help you it helps everyone else who uses the service and guessing what is wrong in their app is not going to make your life any easier,

        print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
Re: checkVat - SOAP::Lite
by Anonymous Monk on May 04, 2011 at 11:19 UTC
      Can't install it via CPAN, strange.

        I'm sure you got more information other than "Can't install". Perhaps if you tell us what cpan actually told you we'd be able to help.

        cpanp i BERLE/SOAP-Simple-0.00_03.tar.gz