Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: checkVat - SOAP::Lite

by Utilitarian (Vicar)
on May 04, 2011 at 14:38 UTC ( [id://902897]=note: print w/replies, xml ) Need Help??


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

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."

Replies are listed 'Best First'.
Re^4: checkVat - SOAP::Lite
by Anonymous Monk on May 04, 2011 at 15:15 UTC
    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' } };
        Nice!
        Unfortunately, we're not in control of the server that we're installing it to, so installing SOAP::Simple isn't an alternative. So I copied your xml output and did it the ugly way:
        #!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; my $userAgent = LWP::UserAgent->new(agent => 'perl post'); my $message = qq^<?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>^; my $response = $userAgent->request(POST 'http://ec.europa.eu/taxation_ +customs/vies/services/checkVatService', Content_Type => 'text/xml', Content => $message); print $response->error_as_HTML unless $response->is_success; print $response->as_string;
        However, I will of course push for getting the SOAP::Simple installed on the target server, but this solved the immediate problem. Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://902897]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-04-19 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found