in reply to Re: checkVat - SOAP::Lite
in thread checkVat - SOAP::Lite

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 +>

Replies are listed 'Best First'.
Re^3: checkVat - SOAP::Lite
by Utilitarian (Vicar) on May 04, 2011 at 14:38 UTC
    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."
      FWIW, I would have never gone digging that up, I just supplied 0 0

      Anyway, it doesn't look like you should bother the nice admin, though he should have supplied example session if you ask me
      soap-lite-sent.xml
      <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl= +"urn:ec.europa.eu:taxud:vies:services:checkVat" xmlns:soap="http://sc +hemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlso +ap.org/soap/encoding/" xmlns:tns1="urn:ec.europa.eu:taxud:vies:servic +es:checkVat:types" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmln +s:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http:// +www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchem +a-instance"> <soap:Body> <impl:checkVat> <countryCode xsi:type="xsd:string">IE</countryCode> <vatNumber xsi:type="xsd:string">1234567890</vatNumber> </impl:checkVat> </soap:Body> </soap:Envelope>
      soap-simple-sent.xml
      <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/env +elope/"> <SOAP-ENV:Body> <tns1:checkVat xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:ch +eckVat:types"> <tns1:countryCode>IE</tns1:countryCode> <tns1:vatNumber>1234567890</tns1:vatNumber> </tns1:checkVat> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
      Could you get SOAP::Lite to generate that kind of SOAP? Probably, but having done it before, I wouldn't bother , too much typing :)

        I forgot to say, the SOAP::Simple generated soap request returns 200 OK and data
        $VAR1 = { 'parameters' => { 'requestDate' => '2011-05-04+02:00', 'vatNumber' => '1234567890', 'valid' => 0, 'countryCode' => 'IE' } };