Skip Menu |
 

This queue is for tickets about the SOAP-Lite CPAN distribution.

Report information
The Basics
Id: 16884
Status: rejected
Priority: 0/
Queue: SOAP-Lite

People
Owner: Nobody in particular
Requestors: d.rowles [...] outcometechnologies.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.66
Fixed in: (no value)



Subject: Sending an XML string using SOAP::Lite doesn't work
Download (untitled) / with headers
text/plain 574b
The attached patch adds some tests to the SOAP::Lite test suite that attempt to serialize and deserialize an XML string. These tests fail using perl 5.8.3, SOAP::Lite 0.66 on Debian Linux, expat 1.95.8-3. These tests die with:- "xml declaration not at start of external entity at line 1, column 391, byte 391 at /opt/perl/lib/site_perl/5.8.3/XML/Parser.pm line 187" I'm not at all familiar with the SOAP::Lite internals or with the test suite - so I *believe* that these tests are correctly demonstrating my problem, however please let me know if there are any problems.
Download soap.diff
text/x-diff 2.2k
diff -urN SOAP-Lite-0.66.orig/t/01-core.t SOAP-Lite-0.66.new/t/01-core.t --- SOAP-Lite-0.66.orig/t/01-core.t 2005-05-15 21:22:37.000000000 +0100 +++ SOAP-Lite-0.66.new/t/01-core.t 2006-01-03 13:43:54.000000000 +0000 @@ -10,7 +10,7 @@ use strict; use Test; -BEGIN { plan tests => 35; } +BEGIN { plan tests => 49; } use SOAP::Lite; @@ -275,3 +275,52 @@ $ret = $deserializer->deserialize($input); ok("one" eq $ret->result->{'complexFoo'}{'arrayFoo'}); } + + + + +# Check that serialization and deserialization of XML strings works OK too +# +{ + # Firstly, check that this works for normal data.... + print "Testing serialization / deserialization of XML entities part 1... \n"; + + my @args = ("bob", (bless { "name" => "Bob" }, "My::Module"), 27, "<hello>World!</hello>"); + my $serializer = SOAP::Serializer->new(); + my $deserializer = SOAP::Deserializer->new(); + my $out = $deserializer->deserialize($serializer->serialize(\@args))->root; + ok(ref($out), "ARRAY"); + ok($out->[0], "bob"); + ok(UNIVERSAL::isa($out->[1], "My::Module")); + ok($out->[1]->{name}, "Bob"); + ok($out->[2], 27); + ok($out->[3], "<hello>World!</hello>"); +} + +{ + print "Testing serialization / deserialization of XML entities part 2... \n"; + + # Now make one of our thingies an XML string that includes a namespace + my @args = ("bob", '<hello xmlns:bob="http://www.example.com/bob">World!</hello>', "Bobbage"); + my $serializer = SOAP::Serializer->new(); + my $deserializer = SOAP::Deserializer->new(); + my $out = $deserializer->deserialize($serializer->serialize(\@args))->root; + ok(ref($out), "ARRAY"); + ok($out->[0], $args[0]); + ok($out->[1], $args[1]); + ok($out->[2], $args[2]); +} + +{ + print "Testing serialization / deserialization of XML entities part 3... \n"; + + # Finally, add an xml header, and watch things die..... + my @args = ("bob", '<?xml version="1.0" encoding="UTF-8"?><hello xmlns:bob="http://www.example.com/bob">World!</hello>', "Bobbage"); + my $serializer = SOAP::Serializer->new(); + my $deserializer = SOAP::Deserializer->new(); + my $out = $deserializer->deserialize($serializer->serialize(\@args))->root; + ok(ref($out), "ARRAY"); + ok($out->[0], $args[0]); + ok($out->[1], $args[1]); + ok($out->[2], $args[2]); +}
Download (untitled) / with headers
text/plain 285b
Hi, The XML spec disallows the use of a XML declaration statement (the <?...?> stuff after the beginning of the document. That is, you may not store an unescaped XML declaration inside a SOAP::Data node. This is a restriction (not a bug) of XML, not of SOAP::Lite. Regards, Martin
Subject: Re: [rt.cpan.org #16884] Sending an XML string using SOAP::Lite doesn't work
Date: Tue, 12 Feb 2008 22:41:42 +0000
To: bug-SOAP-Lite [...] rt.cpan.org
From: Dan Rowles <d.rowles [...] outcometechnologies.com>
Download (untitled) / with headers
text/plain 1.5k
Hello, We're using a SOAP::Server object in order to allow a client to access some methods in a class. On the server side, the code uses an exception object that captures the call stack and arguments when it is thrown, and we're sending that back to the client. This allows the client to see exactly what went wrong on the server, which is really handy during development. Unfortunately, the exception object picks up a call to "SOAP::Server::handle" that includes the raw XML. SOAP::Lite does not encode this (eg in Base64), so that the XML that is sent across the wire looks like:- .... some stuff .... <item xsi:type="xsd:anyURI">Called SOAP::Server::handle(SOAP::Transport::HTTP::Server=HASH(0x87e7538), <?xml version="1.0" encoding="UTF-8"?><soap:Envelope .... etc .... This can't then be decoded at the client end (which is fair enough, really, as it's invalid XML). My suggestion is that SOAP::Lite should check to see if it is encoding a string that contains XML, and if so, should Base64 encode it first, when it is serializing a datastructure. Thanks, Dan Martin Kutter via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=16884 > > > Hi, > > The XML spec disallows the use of a XML declaration statement (the > <?...?> stuff after the beginning of the document. > > That is, you may not store an unescaped XML declaration inside a > SOAP::Data node. > > This is a restriction (not a bug) of XML, not of SOAP::Lite. > > Regards, > > Martin
-- Dan Rowles Outcome Technologies Ltd BUPA House, 15-19 Bloomsbury Way, London WC1A 2BA Registered in England, No: 3829851
Download (untitled) / with headers
text/plain 389b
Hi, you may trigger encoding data as base64 by passing it as SOAP::Data object to SOAP::Lite: SOAP::Data->type('base64binary')->name('element name')->value($xml) Encoding XML by default would break all clients/servers, which put some (valid) XML fragment inside the SOAP envelope (that is SOAP::Lite apps which decide to built up the body content's XML by themselves). Regards, Martin


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.