SOAP::Lite tip

Sorry for the narrow technical scope of this article, but I spent some time searching for the solution to this SOAP::Lite error:

duplicate attribute at line 1, column 454, byte 454 at C:/matt/opt/perl/site/lib/XML/Parser.pm line 187

The problem is that SOAP::Lite versions earlier than 0.65 used the 1999 XML Schema by default. This schema is broken, and the Apache Axis SOAP server (and probably others) have a different interpretation to SOAP::Lite of what is valid markup. In Perl, you need to configure SOAP::Lite to use the 2001 schema like this:

my $svc = SOAP::Lite->service('http://example.com/soap-axis/remoteservice.wsdl');
$svc->xmlschema('http://www.w3.org/2001/XMLSchema');

Then, presto, all transmissions are done in the 2001 schema, and the XML parser is happy.

You could also upgrade to SOAP::Lite version 0.65 or greater, since the default schema is now the 2001 one. However, version 0.55 is still the latest package for ActivePerl, which is why this was a problem for me.

Update 29/4: fixed typo in the code sample.

Portrait of Matt Ryall

About Matt

I’m a technology nerd, husband and father of four, living in beautiful Sydney, Australia.

My passion is building software products that make the world a better place. For the last 15 years, I’ve led product teams at Atlassian to create collaboration tools.

I'm also a startup advisor and investor, with an interest in advancing the Australian space industry. You can read more about my work on my LinkedIn profile.

To contact me, please send an email or reply on Twitter.