SOAP::Lite POD::WSDL and .NET clients

SOAP::Lite POD::WSDL and .NET clients

am 25.04.2007 18:41:15 von Ian Wilson

Is it possible to use POD::WSDL to generate WSDL for a SOAP::Lite
service, such that the generated WSDL can be used to construct a .NET
client?

A couple of things worry me ...
(Apart form RPC/Encoded vs Doc/Literal and SOAPAction tweaking)

1) The element names generated in the returned XML (c_gensym3 ...) don't
match the names mentioned in the WSDL (ArrayOfInt) - does this matter?

2) The WSDL seems to me to imply that the individual temperature
elements ought to be wrapped in an "ArrayOfInt" element (which I could
produce by returning an array ref instead of an array: `return
\@temperatures;`) - Is the WSDL wrong?

Off Topic question (sorry):
I don't know C# or have a C# devkit - what would the stubs look like
that C# developers generate from this WSDL? Would it be much work to
make a simple (command line) C# client?

------ Example service -----
#!perl
use strict;
use warnings;
use SOAP::Transport::HTTP;

SOAP::Transport::HTTP::CGI
-> dispatch_to('Temperatures')
-> handle;

package Temperatures;

=begin WSDL

_RETURN @int Temperatures in three places

=cut

sub getTemperatures {
my @temperatures = (31.1, 28.2, 34.5);
return @temperatures
}
------ perl client ------
#!perl
use strict;
use warnings;
use SOAP::Lite;
use XML;

my $Temperatures = SOAP::Lite
-> uri('http://www.example.com/Temperatures')
-> proxy('http://localhost/cgi-bin/Temperatures.pl')
-> on_fault(sub { my($soap, $res) = @_;
die ref $res ? $res->faultstring : $soap->transport->status, "\n";
});

my @temperatures = $Temperatures->getTemperatures()->paramsall;
print join(', ', @temperatures), "\n";

my $xml = $Temperatures->outputxml(1)->getTemperatures();
XML::print_indented($xml);

------ XML.pm -----
package XML;

sub print_indented {
my $xml = shift;
$xml =~ s/>\n
my @lines = split(/\n/, $xml);

my $indent = 0;
for my $line(@lines) {
if ($line =~ m(^ print ' ' x $indent, $line, "\n";
if ($line =~ m(^<[^/\?])) { $indent++; }
if ($line =~ m(>[^<]+ }
}

1;
------ output from Perl client ------
31.1, 28.2, 34.5

xmlns:S
OAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schem
as.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP
-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding /">

xmlns:namesp1="http://www.example.com/Temperatures">
31.1
28.2
34.5




------ example WSDL generated by POD::WSDL ------


xmlns:impl="http://localhost/Temperatures"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns1="http://localhost/Temperatures">


xmlns="http://www.w3.org/2001/XMLSchema">
















Temperatures in three places





name="getTemperaturesRequest" />
name="getTemperaturesResponse" />





transport="http://schemas.xmlsoap.org/soap/http" />




encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost/Temperatures" use="encoded" />


encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost/Temperatures" use="encoded" />












------------------------------------------------