<?xml version="1.0" encoding="windows-1252"?>
<node id="904609" title="Re^11: Soap::Lite and Complex Types with WSDL" created="2011-05-13 04:11:45" updated="2011-05-13 04:11:45">
<type id="11">
note</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
Ah, ok. The entire code is rarely &lt;i&gt;the fix&lt;/i&gt; around here, usually its a demonstration.&lt;P&gt;
And honestly I dislike SOAP strongly, and I barely understand WSDL :)
&lt;P&gt;
There was a recent question, [id://902906], and I had no clue what was supposed to happen, but it was simpler to use [mod://SOAP::Simple], and it turns out, SOAP::Simple is better with WSDL. The whole program boiled down to
&lt;C&gt;
#!/usr/bin/perl --
use strict;
use warnings;
use LWP::Simple qw' mirror ';
use SOAP::Simple;
use Data::Dumper;

my $wsdlUrl = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
my $wsdlFile = 'checkVatService.wsdl';
mirror( $wsdlUrl, $wsdlFile );

my $soap = SOAP::Simple-&gt;new( $wsdlFile );
my ($answer, $trace) = $soap-&gt;checkVat(
    countryCode =&gt; "IE",
    vatNumber =&gt; "1234567890",
);
print Dumper( $answer ),"\n";
$trace-&gt;printRequest;
$trace-&gt;printResponse;
__END__
&lt;/c&gt;
The output is
&lt;C&gt;
$VAR1 = {
          'parameters' =&gt; {
                            'requestDate' =&gt; '2011-05-13+02:00',
                            'vatNumber' =&gt; '1234567890',
                            'valid' =&gt; 0,
                            'countryCode' =&gt; 'IE'
                          }
        };

Request:
  POST http://ec.europa.eu/taxation_customs/vies/services/checkVatService HTTP/1.1
  User-Agent: libwww-perl/6.02
  Content-Length: 347
  Content-Type: text/xml; charset="utf-8"
  SOAPAction: ""
  X-LWP-Version: 6.02
  X-XML-Compile-Cache-Version: 0.991
  X-XML-Compile-SOAP-Version: 2.23
  X-XML-Compile-Version: 1.21
  X-XML-LibXML-Version: 1.70

  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;SOAP-ENV:Body&gt;&lt;tns1:checkVat xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types"&gt;&lt;tns1:countryCode&gt;IE&lt;/tns1:countryCode&gt;&lt;tns1:vatNumber&gt;1234567890&lt;/tns1:vatNumber&gt;&lt;/tns1:checkVat&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;

Response:
  HTTP/1.1 200 OK
  Connection: Keep-Alive
  Date: Fri, 13 May 2011 08:01:45 GMT
  Content-Type: text/xml; charset=utf-8
  Client-Date: Fri, 13 May 2011 08:01:53 GMT
  Client-Peer: 147.67.119.103:80
  Client-Response-Num: 1
  Client-Transfer-Encoding: chunked

  &lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soapenv:Body&gt;&lt;urn:checkVatResponse xmlns:urn="urn:ec.europa.eu:taxud:vies:services:checkVat:types"&gt;&lt;urn:countryCode&gt;IE&lt;/urn:countryCode&gt;&lt;urn:vatNumber&gt;1234567890&lt;/urn:vatNumber&gt;&lt;urn:requestDate&gt;2011-05-13+02:00&lt;/urn:requestDate&gt;&lt;urn:valid&gt;false&lt;/urn:valid&gt;&lt;/urn:checkVatResponse&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
&lt;/c&gt;
Looks simple indeed :)</field>
<field name="root_node">
904155</field>
<field name="parent_node">
904314</field>
<field name="reputation">
1</field>
</data>
</node>
