Posted on 2007-05-07 04:42:19-07 by nigol

Hi, I wanted to use the SOAP::WSDL module, but when processing the WSDL is fails as common parts of the schema definition are defined within an import tag:

<xs:import namespace="http://servicecenter.peregrine.com/PWS/Common" schemaLocation="http://myServer:12670/PWS/Common.xsd"></xs:import>

As the WSDL is coming from Peregrine's Service Centre tool, I can not change it. Is there a way to tell SOAP::WSDL to import the remaining information? Thanks, Nigol

Posted on 2007-06-08 17:44:19-07 by mkutter in response to 5064

Hi Nigol,

unfortunately, there's no known way to do this, yet. SOAP::WSDL uses XML::XPath for parsing the WSDL, and XML::XPath unfortunately cannot resolve the import-Element. I would suggest to download the WSDL, store it on disk, and insert the schema found at the specified URL into it. Unless the WSDL changes on every call (which is a bit unlikely), there's no reason why you should not be able to change it - storing it on disk instead of using a http(s) URL is even recommended for performance reasons. Regards, Martin

Posted on 2007-06-12 00:14:24-07 by nigol in response to 5375

OK,Thanks for the answer. Nigol

Posted on 2008-05-26 20:09:00-07 by babzog in response to 5375

Something old, is new again. :) My script, based on a lightly modified weather_wsdl.pl:

use lib 'lib/';
use lib '../lib';

# SOAP::WSDL variant
use SOAP::WSDL;
my $soap = SOAP::WSDL->new();

my $som = $soap->wsdl("http://192.168.2.39/NetManagerServicesBinding.wsdl")
  ->call('getSoftwareVersion',NULL
);

die "Error" if $som->fault();
print $som->result();

results in:

cannot import document for namespace >http://schemas.xmlsoap.org/soap/encoding/< without location at /usr/lib/perl5/site_perl/5.8.8/SOAP/WSDL/Expat/WSDLParser.pm line 71.
Can't locate object method "set_arrayType" via package "SOAP::WSDL::XSD::Attribute" at /usr/lib/perl5/site_perl/5.8.8/SOAP/WSDL/Base.pm line 123
 at line 239 at /usr/lib/perl5/site_perl/5.8.8/SOAP/WSDL/Expat/Base.pm line 76

and that seems to be because of the following:

 <schema targetNamespace="http://NM2WebServices/NM2Soap"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:NetManager="http://NM2WebServices/NM2Soap"
  xmlns:NetManager2="http://NetManager/NetManager2"
  xmlns="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="unqualified"
  attributeFormDefault="unqualified">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
  <simpleType name=...

This WSDL file is generated by gSoap (http://www.cs.fsu.edu/~engelen/soap.html) and it imports fine into soapUI so I'm assuming it's fine. If I go to http://schemas.xmlsoap.org/soap/encoding/, cut&paste the whole thing in place of the <import ... /> blocks, I then get:

unbound prefix at line 61, column 4, byte 4064 at /usr/lib/perl5/site_perl/5.8.8/SOAP/WSDL/Expat/Base.pm line 73
 at line 61 at /usr/lib/perl5/site_perl/5.8.8/SOAP/WSDL/Expat/Base.pm line 76

Any thoughts?

Posted on 2009-10-19 19:55:19-07 by jcroall in response to 5375

Hi Martin, All, Are there any other Perl SOAP/WSDL modules that support this common feature? Perl seems to be lagging behind every other language out there when it comes to SOAP/Web Services. SOAP::Lite doesn't support complex types when using WSDL, SOAP::WSDL doesn't support WS-Security or this import feature, ... I wonder how difficult it would be to add complex types to SOAP::Lite?

Thanks, - James

(This article is based on a thread on the CPAN::Forum.)