Subject: | Invalid response envelope with use_default_ns = 0 |
I use SOAP::Lite server with use_default_ns set to 0 to have my response
elements prefixed. When data returned from dispatched function are
qualified by namespace, SOAP::Lite creates invalid response soap envelope.
This can be clearly ilustrated with serializer only without any soap call:
use strict;
use SOAP::Lite 'use_default_ns' => 0;
my $ns = 'http://tempuri.org';
my $soap = SOAP::Lite->ns($ns);
my $envelope = $soap->serializer->envelope(
'response' => 'fooResponse',
SOAP::Data->new(
'uri' => $ns,
'name' => 'fooResult',
'value' => 'Abrakadabra',
)
);
print $envelope, "\n";
Script above produces following XML
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:namesp4="http://tempuri.org"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
<namesp1:fooResponse><namesp4:fooResult xsi:type="xsd:string"
xmlns:namesp4="http://tempuri.org">Abrakadabra</namesp4:fooResult></namesp1:fooResponse></soap:Body></soap:Envelope>
This XML is invalid since there is no namespace declaration for prefix
the response element prefix namesp1.