Subject: | Some namespace declarations confuse "explain" |
Two of the attached WSDL files work just fine, but the one named
"simple_bad" confuses XML::Compile::WSDL11->explain. Running the
attached script should "explain" the testOp method three times, but
instead the simple_bad WSDL gives
error: no prefix known for namespace http://www.example.com/otherSchema
The offending line seems to be
<wsdl:part name="testInReq" element="ns:testDetails"
xmlns:ns="http://www.example.com/otherSchema"/>
That's legal, right? The "ns" in the QName isn't ambiguous or anything?
If "http://www.example.com/otherSchema" is given a name somewhere else
in the file, explain works.
It's interesting to note that "compile" and "call" work fine in all
cases; it's just "explain" that is a problem. So it's not like you
can't use the WSDL with the funny namespaces. You just can't get
explain to help.
This example was inspired by something on the mailing list last month,
where the advice was to examine the output of "explain" but that just
caused more errors.
Subject: | simple_good.wsdl |
Message body not shown because it is not plain text.
Subject: | wsdl_test_explain.pl |
#!/usr/bin/perl
use strict ;
use warnings ;
use Data::Dumper ;
use XML::Compile::WSDL11;
use XML::Compile::SOAP11;
use XML::Compile::Transport::SOAPHTTP;
# use Log::Report mode => 'DEBUG'; # enable debugging
foreach my $w (qw/simple_bad.wsdl simple_good.wsdl simple_good2.wsdl/) {
print "Examining $w\n" ;
eval {
tryWSDL($w) ;
} ;
warn $@ if $@ ;
print '-x' x 10, "\n" ;
}
sub tryWSDL {
my ($wsdlfile) = @_ ;
my $wsdl = XML::Compile::WSDL11->new($wsdlfile);
# warn "Compiling" ;
my $call = $wsdl->compileClient( 'testOp'
, transport_hook => \&fake_server
);
# warn "Executing" ;
my ($answer, $trace) = $call->( { testInReq => {} } ) ;
print "Answer is " . Dumper($answer) ;
# warn "Explaining" ;
print $wsdl->explain( 'testOp',
PERL => 'INPUT',
recurse => 1,
);
}
sub fake_server($$)
{ my ($request, $trace) = @_;
my $content = $request->decoded_content;
$content =~ s/></>\n</g;
# print $content;
my $answer = <<_ANSWER;
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:x0="boo">
<SOAP-ENV:Body>
<x0:hasVersion>3.14</x0:hasVersion>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
_ANSWER
use HTTP::Response;
HTTP::Response->new
( HTTP::Status::RC_OK
, 'answer manually created'
, [ 'Content-Type' => 'text/xml' ]
, $answer
);
}
Subject: | simple_bad.wsdl |
Message body not shown because it is not plain text.
Subject: | simple_good2.wsdl |
Message body not shown because it is not plain text.