I
iamdannywa
I had a SOAP funtion make a generic return of an untyped array which
consisted of a URL and a file path (for maintaining an image
repository). The function worked as expected until it encountered an
address (URL) that had multiple query parameters and thus a bare '&' in
the URL.
The SOAP::Lite serializer typed the content as anyURI just as you would
expect from teh documentation. However, the serializer did not encode
the '&' as '&' and the XML validation of the SOAP envelope failed.
Should the serializer of type anyURI entity encode to render valid XML?
I think so, but I cannot find any documentation to argue either way.
Here is a snippet of server code. it will showcase the problem I am
experiencing. In this example I type the return values. In my actual
webservice I allowed SOAP::Lite to type it and it will always type a
URL formatted string as anyURI.
CODE:::
BEGIN {
package SOAP_ImageMgr;
sub Hello {
my $self = shift;
my $badURI = 'http://www.com/cgi?text=Hello World&doit=Goodbye';
return (
SOAP:ata->type('anyURI')->value($badURI),
SOAP:ata->type('string')->value($badURI)
);
}
1;
}
use SOAP::Transport::HTTP;
our $srv = SOAP::Transport::HTTP::CGI->dispatch_to('SOAP_ImageMgr');
$srv->serializer->encoding();
$srv->handle();
Where to go from here?
consisted of a URL and a file path (for maintaining an image
repository). The function worked as expected until it encountered an
address (URL) that had multiple query parameters and thus a bare '&' in
the URL.
The SOAP::Lite serializer typed the content as anyURI just as you would
expect from teh documentation. However, the serializer did not encode
the '&' as '&' and the XML validation of the SOAP envelope failed.
Should the serializer of type anyURI entity encode to render valid XML?
I think so, but I cannot find any documentation to argue either way.
Here is a snippet of server code. it will showcase the problem I am
experiencing. In this example I type the return values. In my actual
webservice I allowed SOAP::Lite to type it and it will always type a
URL formatted string as anyURI.
CODE:::
BEGIN {
package SOAP_ImageMgr;
sub Hello {
my $self = shift;
my $badURI = 'http://www.com/cgi?text=Hello World&doit=Goodbye';
return (
SOAP:ata->type('anyURI')->value($badURI),
SOAP:ata->type('string')->value($badURI)
);
}
1;
}
use SOAP::Transport::HTTP;
our $srv = SOAP::Transport::HTTP::CGI->dispatch_to('SOAP_ImageMgr');
$srv->serializer->encoding();
$srv->handle();
Where to go from here?