the.duck has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks-

I am in dire need of assistance with SOAP::WSDL. I'll admit upfront to being an average Perl programmer, and knowing little to nothing about WSDL, however, I've been thrust to the front lines and am confounded.

I'm working with our internal .NET team and they've chosen (or perhaps mandated) this format, and they also are using (and require) Complex datatypes. From what I read, this makes using SOAP::LITE more challenging, so I opted to go with SOAP::WSDL.

If I try to generate the bindings through wsdl2perl.pl I get many things generated, but I don't get any interfaces. Which seems to mean to me that something is failing.

When I call SOAP::WSDL directly like so:

use warnings; use strict; use SOAP::WSDL; use Data::Dumper; my $soap = SOAP::WSDL->new( wsdl => 'http://bar.foo.com/EventServices.svc?wsdl', ); my $result = $soap->call('NewEvent', %data); my ($body_ref,$header_ref); print Dumper($result);
I get the following error
cannot import document from namespace >http://tempuri.org/< without ba +se uri. Use >parse_uri< or >set_uri< to set one. at /usr/local/lib/pe +rl5/site_perl/5.10.1/SOAP/WSDL/Expat/WSDLParser.pm line 96. at line 1 at /usr/local/lib/perl5/site_perl/5.10.1/SOAP/WSDL/Expat/Ba +se.pm line 82

I've been googling to the point my eyes are bleeding. If I could wrap an answer around the problem that isn't "It's .NET's fault" I may be able to make some progress between us. For right now the attitude is one of "you're tools (meaning Perl) can't handle it".

Replies are listed 'Best First'.
Re: wsdl2perl.pl & SOAP::WSDL
by Khen1950fx (Canon) on Mar 19, 2010 at 22:56 UTC
    If you are using wsdl2perl.pl, then there would be a different format. In general, you might try something like:
    #!/usr/bin/perl use strict; use warnings; use SOAP::WSDL; use Data::Dumper; use Devel::SimpleTrace; my $soap = SOAP::WSDL->new( wsdl => 'file://bar.wsdl', ); my ($body_ref, $header_ref); my $result = $soap->call('NewEvent', $body_ref, $header_ref); print Dumper($result);
    I'm pressed for time right now, but I'll post a full example for you later tonight.

    Update: This is as far as I can go right now. I'll have to finish it tomorrow.

    Update: 3-22-10
    As far as I can tell, the module works fine. The problem is with the wsdl---it's not valid. Here's the current code:

    #!/usr/bin/perl use strict; use warnings; use SOAP::WSDL; use SOAP::Lite +trace => 'debug'; my $soap = SOAP::WSDL->new( wsdl => 'file://root/Desktop/duckie/primes.xml', ); $soap->wsdlinit( servicename => 'PrimeNumbers', portname => 'PrimeNumbersSoap', ); my $result = $soap->call('GetPrimeNumbers'); print $result, "\n";
    First:
    wsdl2perl.pl -b /root/Desktop/duck http://www50.brinkster.com/vbfacile +inpt/np.asmx?wsdl
    Second: primes.wsdl
    ?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" x +mlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www +.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soa +p/encoding/" xmlns:tns="http://microsoft.com/webservices/" xmlns:tm=" +http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://sche +mas.xmlsoap.org/wsdl/mime/" targetNamespace="http://microsoft.com/web +services/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="http://m +icrosoft.com/webservices/"> <s:element name="GetPrimeNumbers"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="max" type="s: +int"/> </s:sequence> </s:complexType> </s:element> <s:element name="GetPrimeNumbersResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="GetPrimeNumbe +rsResult" type="s:string"/> </s:sequence> </s:complexType> </s:element> <s:element name="string" nillable="true" type="s:string"/> </s:schema> </wsdl:types> <wsdl:message name="GetPrimeNumbersSoapIn"> <wsdl:part name="parameters" element="tns:GetPrimeNumbers"/> </wsdl:message> <wsdl:message name="GetPrimeNumbersSoapOut"> <wsdl:part name="parameters" element="tns:GetPrimeNumbersResponse" +/> </wsdl:message> <wsdl:message name="GetPrimeNumbersHttpGetIn"> <wsdl:part name="max" type="s:string"/> </wsdl:message> <wsdl:message name="GetPrimeNumbersHttpGetOut"> <wsdl:part name="Body" element="tns:string"/> </wsdl:message> <wsdl:message name="GetPrimeNumbersHttpPostIn"> <wsdl:part name="max" type="s:string"/> </wsdl:message> <wsdl:message name="GetPrimeNumbersHttpPostOut"> <wsdl:part name="Body" element="tns:string"/> </wsdl:message> <wsdl:portType name="PrimeNumbersSoap"> <wsdl:operation name="GetPrimeNumbers"> <wsdl:input message="tns:GetPrimeNumbersSoapIn"/> <wsdl:output message="tns:GetPrimeNumbersSoapOut"/> </wsdl:operation> </wsdl:portType> <wsdl:portType name="PrimeNumbersHttpGet"> <wsdl:operation name="GetPrimeNumbers"> <wsdl:input message="tns:GetPrimeNumbersHttpGetIn"/> <wsdl:output message="tns:GetPrimeNumbersHttpGetOut"/> </wsdl:operation> </wsdl:portType> <wsdl:portType name="PrimeNumbersHttpPost"> <wsdl:operation name="GetPrimeNumbers"> <wsdl:input message="tns:GetPrimeNumbersHttpPostIn"/> <wsdl:output message="tns:GetPrimeNumbersHttpPostOut"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="PrimeNumbersSoap" type="tns:PrimeNumbersSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" sty +le="document"/> <wsdl:operation name="GetPrimeNumbers"> <soap:operation soapAction="http://microsoft.com/webservices/Get +PrimeNumbers" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="PrimeNumbersHttpGet" type="tns:PrimeNumbersHttpG +et"> <http:binding verb="GET"/> <wsdl:operation name="GetPrimeNumbers"> <http:operation location="/GetPrimeNumbers"/> <wsdl:input> <http:urlEncoded/> </wsdl:input> <wsdl:output> <mime:mimeXml part="Body"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="PrimeNumbersHttpPost" type="tns:PrimeNumbersHttp +Post"> <http:binding verb="POST"/> <wsdl:operation name="GetPrimeNumbers"> <http:operation location="/GetPrimeNumbers"/> <wsdl:input> <mime:content type="application/x-www-form-urlencoded"/> </wsdl:input> <wsdl:output> <mime:mimeXml part="Body"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="PrimeNumbers"> <wsdl:port name="PrimeNumbersSoap" binding="tns:PrimeNumbersSoap"> <soap:address location="http://www50.brinkster.com/vbfacileinpt/ +np.asmx"/> </wsdl:port> <wsdl:port name="PrimeNumbersHttpGet" binding="tns:PrimeNumbersHtt +pGet"> <http:address location="http://www50.brinkster.com/vbfacileinpt/ +np.asmx"/> </wsdl:port> <wsdl:port name="PrimeNumbersHttpPost" binding="tns:PrimeNumbersHt +tpPost"> <http:address location="http://www50.brinkster.com/vbfacileinpt/ +np.asmx"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
    Third: the code(needs more work, but it's the general idea:))
    #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Devel::SimpleTrace; use SOAP::WSDL; my $soap = SOAP::WSDL->new( wsdl => 'file:///root/Desktop/duck/primes.wsdl', ); my ($body_ref, $header_ref); my $result = $soap->call('GetPrimeNumbers', $body_ref, $header_ref); print Dumper($result);

      Thanks for the response. My fear is that it's with the WSDL. It's WCF generated, and the developer is about as familiar with WSDL as I am. I guess we've just gotta keep hashing it out. Thanks again.