Subject: | Failed t/03-server.t tests 2-5 under Perl 5.10 on Mac OS X 10.3.9 |
The problem seems to be that under Perl 5.10.0, t/03-server.t tests 2-5
appear to find a Calculator class, though not its add() method. I went
ahead and forced the install, and have had no problems so far. I am
running Darwin 7.9 (i.e. Mac OS X 10.3.9).
The test was done under 0.69, which is the most-current version I can
find on CPAN. I will happily test one of the development versions if you
can point me to them. Other information will be provided on request.
To diagnose, I modified t/03-server.t to report the value of
faultstring. Logs of the verbose output under Perl 5.8.8 and 5.10.0 are
attached, as is the modified test. I also tried (and failed) to find an
actual 'Calculator' class under 5.10.0. Not suprisingly, unplugging from
the network also did not affect this test. Other miscellaneous output
follows. Thank you for your time and attention.
$ perl5.10.0 -MCalculator -e ''
Can't locate Calculator.pm in @INC (@INC contains: /sw/lib/perl5
/sw/lib/perl5/darwin /usr/local/lib/perl5/5.10.0/darwin-2level
/usr/local/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/darwin-2level
/usr/local/lib/perl5/site_perl/5.10.0 .).
BEGIN failed--compilation aborted.
Yes, Mac OS X has a case-insensitive file system, but the only way I can
think of for this to cause 'Calculator' to be loaded is if there is a
'calculator' (or some other case permutation) in the path, and I can't
find it. The above should prove it's not in the normal paths, and 'find
. -iname calculator\*' in the kit found nothing. If you can think of
anywhere else it might have come from, please let me know.
$ uname -a
Darwin Wyants-White-iMac.local 7.9.0 Darwin Kernel Version 7.9.0: Wed
Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power
Macintosh powerpc
$ perl5.10.0 -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=darwin, osvers=7.9.0, archname=darwin-2level
uname='darwin wyants-white-imac.local 7.9.0 darwin kernel version
7.9.0: wed mar 30 20:11:17 pst 2005;
root:xnuxnu-517.12.7.obj~1release_ppc power macintosh powerpc '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp
-fno-strict-aliasing -pipe -I/usr/local/include',
optimize='-Os',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp
-fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build
1671)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib
libs=-ldbm -ldl -lm -lc
perllibs=-ldl -lm -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup
-L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
USE_LARGE_FILES USE_PERLIO
Built under darwin
Compiled at Dec 29 2007 20:45:26
%ENV:
PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin"
PERL5_CPANPLUS_IS_RUNNING="13599"
PERL5_CPAN_IS_RUNNING="13599"
PERLPKGOPT="-noppm"
@INC:
/sw/lib/perl5
/sw/lib/perl5/darwin
/usr/local/lib/perl5/5.10.0/darwin-2level
/usr/local/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/darwin-2level
/usr/local/lib/perl5/site_perl/5.10.0
.
Subject: | 03-server.t |
#!/bin/env perl
BEGIN {
unless(grep /blib/, @INC) {
chdir 't' if -d 't';
unshift @INC, '../lib' if -d '../lib';
}
}
use strict;
use Test;
BEGIN { plan tests => 32 }
$SIG{__WARN__} = sub { ; }; # turn off deprecation warnings
use SOAP::Lite;
my($a, $s, $r, $serialized, $deserialized);
my %tests = (
'XML only' => <<'EOM',
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soap:Body>
<namesp1:add xmlns:namesp1="http://www.soaplite.com/Calculator">
<c-gensym5 xsi:type="xsd:int">2</c-gensym5>
<c-gensym7 xsi:type="xsd:int">5</c-gensym7>
</namesp1:add>
</soap:Body>
</soap:Envelope>
EOM
'message with headers' => <<'EOM',
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soap:Body>
<namesp1:add xmlns:namesp1="http://www.soaplite.com/Calculator">
<c-gensym5 xsi:type="xsd:int">2</c-gensym5>
<c-gensym7 xsi:type="xsd:int">5</c-gensym7>
</namesp1:add>
</soap:Body>
</soap:Envelope>
EOM
'singlepart MIME' => <<'EOM',
Content-Type: Multipart/Related; boundary=MIME_boundary; type="text/xml"; start="<calc061400a.xml@soaplite.com>"
--MIME_boundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <calc061400a.xml@soaplite.com>
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soap:Body>
<namesp1:add xmlns:namesp1="http://www.soaplite.com/Calculator">
<c-gensym5 xsi:type="xsd:int">2</c-gensym5>
<c-gensym7 xsi:type="xsd:int">5</c-gensym7>
</namesp1:add>
</soap:Body>
</soap:Envelope>
--MIME_boundary--
EOM
'multipart MIME' => <<'EOM',
Content-Type: Multipart/Related; boundary=MIME_boundary; type="text/xml"; start="<calc061400a.xml@soaplite.com>"
--MIME_boundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <calc061400a.xml@soaplite.com>
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soap:Body>
<namesp1:add xmlns:namesp1="http://www.soaplite.com/Calculator">
<c-gensym5 xsi:type="xsd:int">2</c-gensym5>
<c-gensym7 xsi:type="xsd:int">5</c-gensym7>
</namesp1:add>
</soap:Body>
</soap:Envelope>
--MIME_boundary
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID: <calc061400a.a@soaplite.com>
2
--MIME_boundary
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID: <calc061400a.b@soaplite.com>
5
--MIME_boundary--
EOM
'multipart MIME w/multiref' => <<'EOM',
Content-Type: Multipart/Related; boundary=MIME_boundary; type="text/xml"; start="<calc061400a.xml@soaplite.com>"
--MIME_boundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <calc061400a.xml@soaplite.com>
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soap:Body>
<namesp1:add xmlns:namesp1="http://www.soaplite.com/Calculator">
<c-gensym5 href="cid:calc061400a.a@soaplite.com"/>
<c-gensym7 href="cid:calc061400a.b@soaplite.com"/>
</namesp1:add>
</soap:Body>
</soap:Envelope>
--MIME_boundary
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID: <calc061400a.a@soaplite.com>
2
--MIME_boundary
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID: <calc061400a.b@soaplite.com>
5
--MIME_boundary--
EOM
);
eval "SOAP::Packager::MIME->new->initialize_parser";
my $is_mimetools_installed = $@ ? 0 : 1;
(my $reason = $@) =~ s/ at .+// unless $is_mimetools_installed;
print "MIME tests will be skipped: $reason" if defined $reason;
my $package = '
package Calculator;
sub new { bless {} => ref($_[0]) || $_[0] }
sub add { $_[1] + $_[2] }
sub schema { $SOAP::Constants::DEFAULT_XML_SCHEMA }
1;';
# TEST 1-4
{
print "Server handler test(s)...\n";
my $server = SOAP::Server->dispatch_to('Calculator');
foreach (keys %tests) {
my $result = SOAP::Deserializer->deserialize($server->handle($tests{$_}));
skip(($_ =~ /XML/ || !$is_mimetools_installed),
($result->faultstring || '') =~ /Failed to access class \(Calculator\)/);
print "# \$result->faultstring = ", $result->faultstring;
}
eval $package or die;
foreach (keys %tests) {
my $result = SOAP::Deserializer->deserialize($server->handle($tests{$_}));
skip(($_ =~ /XML/ || !$is_mimetools_installed),
($result->result || 0) == 7);
}
}
{
print "Server handler with complex dispatches test(s)...\n";
foreach my $server (
# dispatch to class
SOAP::Server->dispatch_to('Calculator'),
# dispatch to object
SOAP::Server->dispatch_to(Calculator->new),
# dispatch to regexp
SOAP::Server->dispatch_to('Calc\w+'),
# dispatch URI to class
SOAP::Server->dispatch_with({'http://www.soaplite.com/Calculator' => 'Calculator'}),
# dispatch URI to object
SOAP::Server->dispatch_with({'http://www.soaplite.com/Calculator' => Calculator->new}),
# dispatch quoted SOAPAction to class
SOAP::Server->action('"http://action/#method"')
->dispatch_with({'http://action/#method' => 'Calculator'}),
# dispatch non-quoted SOAPAction to class
SOAP::Server->action('http://action/#method')
->dispatch_with({'http://action/#method' => 'Calculator'}),
# dispatch to class and BAD regexp.
SOAP::Server->dispatch_to('\protocols', 'Calculator')
) { # end for
my $result = SOAP::Deserializer->deserialize($server->handle($tests{'XML only'}));
ok(($result->result || 0) == 7);
}
}
{
print "Error handling in server test(s)...\n";
$a = SOAP::Server->handle('<a></a>');
ok($a =~ /Can't find root/);
$a = SOAP::Server->handle('<Envelope></Envelope>');
ok($a =~ /Can't find method/);
$a = SOAP::Server->handle('<Envelope><Body><Add><a>1</a><b>1</b></Add></Body></Envelope>');
ok($a =~ /Denied access to method/);
$a = SOAP::Server->handle('<soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soap:Body></soap:Body></soap:Envelope>');
ok($a =~ /Can't find method/);
}
{
print "Envelope with no namespaces test(s)...\n";
eval 'sub add { $_[1] + $_[2] }; 1' or die;
my $result = SOAP::Deserializer->deserialize(SOAP::Server->dispatch_to('add')->handle('<Envelope><Body><add><a>3</a><b>4</b></add></Body></Envelope>'));
ok(($result->result || 0) == 7);
}
{
print "Different XML Schemas test(s)...\n";
my $server = SOAP::Server->dispatch_to('Calculator');
$a = $server->handle('<soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soap:Body>
<namesp1:schema xmlns:namesp1="http://www.soaplite.com/Calculator"/>
</soap:Body></soap:Envelope>');
ok($a =~ m!xsi="http://www.w3.org/2001/XMLSchema-instance"!);
ok($a =~ m!xsd="http://www.w3.org/2001/XMLSchema"!);
ok($a =~ m!>http://www.w3.org/2001/XMLSchema<!);
$a = $server->handle('<soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<namesp1:schema xmlns:namesp1="http://www.soaplite.com/Calculator">
<c-gensym5 xsi:type="xsd:int">2</c-gensym5>
</namesp1:schema>
</soap:Body></soap:Envelope>');
ok($a =~ m!xsi="http://www.w3.org/2001/XMLSchema-instance"!);
ok($a =~ m!xsd="http://www.w3.org/2001/XMLSchema"!);
ok($a =~ m!>http://www.w3.org/2001/XMLSchema<!);
$a = $server->handle('<soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<namesp1:schema xmlns:namesp1="http://www.soaplite.com/Calculator">
<c-gensym5 xsi:type="xsd:int">2</c-gensym5>
</namesp1:schema>
</soap:Body></soap:Envelope>');
ok($a =~ m!xsi="http://www.w3.org/2001/XMLSchema-instance"!);
ok($a =~ m!xsd="http://www.w3.org/2001/XMLSchema"!);
ok($a =~ m!>http://www.w3.org/2001/XMLSchema<!);
}
Subject: | perl5.10.0.log |
Message body not shown because it is not plain text.
Subject: | perl5.8.8.log |
Message body not shown because it is not plain text.