[Xml-compile] multiple WSDL files, the first of which does not have a service definition

Karen Etheridge perl at froods.org
Wed Oct 3 20:41:25 GMT 2012


I have a WSDL split out over multiple files, with the <wsdl:service> tag
defined in the second file.

I am loading them via:
my $wsdl = XML::Compile::WSDL11->new($wsdlfiles[0]);
$wsdl->addWSDL($_) foreach @wsdlfiles[1 .. $#wsdlfiles-1];

However, this results in the error:
error: no service definition so needs 1 binding, found 0

...which comes from WSDL11.pm line 194 while loading the first file.  Is
this correct and unavoidable? Does the first file loaded *have* to contain
either a service definition or a binding?  (If I switch the load order of
the files, so that the file with the service definition is loaded first,
there is no error, but that requires that I must know which file that is,
so I can order the filenames accordingly.)


PS: I see that in XML::Compile::WSDL11::init(), if multiple WSDL
files are passed as an arrayref, they are passed as a list to addWSDL, but
addWSDL only uses the first argument - so I think that one of these changes
should be made:
- init should call ->addWSDL($_) foreach (ref $wsdl eq 'ARRAY' ? @$wsdl : $wsdl)
        instead of ->addWSDL(ref $wsdl eq 'ARRAY' ? @$wsdl : $wsdl);
- or: addWSDL should accept a list, and iterate over that list
- or: addWSDL should accept a listref, and iterate over that listref





More information about the Xml-compile mailing list