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)



MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Subject: Sending an XML string using SOAP::Lite doesn't work
Content-Type: multipart/mixed; boundary="----------=_1136296011-4954-0"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 574
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.
Content-Type: text/plain; name="soap.diff"
Content-Disposition: inline; filename="soap.diff"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 2346
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]); +}
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
Message-Id: <rt-3.6.HEAD-30835-1201725578-758.16884-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 285
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
X-Originalarrivaltime: 12 Feb 2008 22:43:05.0703 (UTC) FILETIME=[A1E42770:01C86DC8]
MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-30835-1201725578-758.16884-6-0 [...] rt.cpan.org>
References: <RT-Ticket-16884 [...] rt.cpan.org> <rt-3.6.HEAD-30835-1201725578-758.16884-6-0 [...] rt.cpan.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Organization: Outcome Technologies
X-RT-Original-Encoding: utf-8
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 16C834D80B4 for <bug-SOAP-Lite [...] rt.cpan.org>; Tue, 12 Feb 2008 20:30:45 -0500 (EST)
Received: (qmail 8855 invoked from network); 12 Feb 2008 22:41:55 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 12 Feb 2008 22:41:55 -0000
Received: from amy.weboutcome.com (HELO amy.weboutcome.com) (212.135.97.16) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Feb 2008 14:41:48 -0800
Received: from vicky.internal.weboutcome.com ([172.26.2.28]) by amy.weboutcome.com with esmtp (Exim 4.50) id 1JP3os-0003gV-3S for bug-SOAP-Lite [...] rt.cpan.org; Tue, 12 Feb 2008 22:41:43 +0000
Received: from [172.26.3.71] ([172.26.3.71]) by vicky.internal.weboutcome.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 12 Feb 2008 22:43:05 +0000
Delivered-To: cpan-bug+SOAP-Lite [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #16884] Sending an XML string using SOAP::Lite doesn't work
User-Agent: Icedove 1.5.0.14pre (X11/20071018)
Return-Path: <D.Rowles [...] outcometechnologies.com>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-SOAP-Lite [...] rt.cpan.org
Date: Tue, 12 Feb 2008 22:41:42 +0000
X-Spam-Level: *
Message-Id: <47B220A6.9040707 [...] outcometechnologies.com>
To: bug-SOAP-Lite [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Dan Rowles <d.rowles [...] outcometechnologies.com>
X-RT-Original-Encoding: utf-8
RT-Message-ID: <rt-3.6.HEAD-22060-1202866284-1056.16884-0-0 [...] rt.cpan.org>
Content-Length: 1618
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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
Message-Id: <rt-3.6.HEAD-25315-1203157194-52.16884-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 389
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.