Skip Menu |

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

Report information
The Basics
Id: 34079
Status: resolved
Priority: 0/
Queue: XML-Compile-SOAP

People
Owner: Nobody in particular
Requestors: drew [...] drewtaylor.com
Cc:
AdminCc:

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



Subject: Problem with <xs:choice><xs:sequence>...</xs:sequence></xs:choice>
I'm writing a SOAP server and ran into an issue with the data structure needed for the WRITER. I don't think I should need the top level "Success" hash key (and in fact I get a warning: "mistake: tag `Success' not used at {http://www.opentravel.org/OTA/2003/05}OTA_PingRS#el(OTA_PingRS)" if it's included. But if I don't then I only get the outermost element <OTA_PingRS>, with none of the inner elements (<Success>, <EchoData>). The writer object is constructed like: my $res = pack_type($ns, $msg); my $write = $wsdl->compile(WRITER => $res, elements_qualified => 'TOP' ); The writer returns the following SOAP message: <x0:OTA_PingRS xmlns:x0="http://www.opentravel.org/OTA/2003/05" Version="1"><x0:Success/><x0:EchoData>Hello world!</x0:EchoData></x0:OTA_PingRS> The data structure I'm passing to $write: { Version => 1, Success => 1, # true value required for sequence. Bug??? seq_Success => [{ Success => {}, EchoData => $echo, }] } And the schema for the message: <xs:element name="OTA_PingRS"> <xs:complexType> <xs:choice> <xs:sequence maxOccurs="2"> <xs:element name="Success" type="SuccessType"/> <xs:element name="Warnings" type="WarningsType" minOccurs="0"/> <xs:element name="EchoData" type="xs:string"> </xs:element> </xs:sequence> <xs:element name="Errors" type="ErrorsType"/> </xs:choice> <xs:attributeGroup ref="OTA_PayloadStdAttributes"/> </xs:complexType> </xs:element> <xs:complexType name="SuccessType"> <!-- This element is normally empty and used as a boolean --> </xs:complexType>
On Fri Mar 14 07:41:06 2008, drew@drewtaylor.com wrote: Show quoted text
> > The data structure I'm passing to $write: > { > Version => 1, > Success => 1, # true value required for sequence. Bug??? > seq_Success => [{ > Success => {}, > EchoData => $echo, > }] > }
Following up to myself, I just read about the template functionality (marvelous idea!) and gave it a shot. Unfortunately, the structure it suggests: OTA_PingRS => { # choice of seq_Success, Errors # sequence of Success, Warnings, EchoData # occurs 1 <= # <= 2 times seq_Success => [ { Success => "", }, <snipped> { # is a {http://www.w3.org/2001/XMLSchema}string EchoData => "example", }, <snipped> ], <snipped> } doesn't work either. My writer gets the unused tag warning, and only the outer element <OTA_PingRS> is written.
Subject: Re: [rt.cpan.org #34079] Problem with <xs:choice><xs:sequence>...</xs:sequence></xs:choice>
Date: Fri, 14 Mar 2008 15:36:47 +0100
To: Drew Taylor via RT <bug-XML-Compile-SOAP [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Drew Taylor via RT (bug-XML-Compile-SOAP@rt.cpan.org) [080314 13:34]: Show quoted text
> Following up to myself, I just read about the template functionality > (marvelous idea!) and gave it a shot.
The best explanation of a schema is an example. People told me it was undoable ;-) By the way: these are XML::Compile issues, not XML::Compile::SOAP. Show quoted text
> Unfortunately, the structure it suggests:
Wow... you have a nice concentration of complexities for me. It already resulted in two bugs in the example generation. This should look like # choice of seq_Success, Errors # sequence of Success, EchoData # occurs 1 <= # <= 2 times seq_Success => [ { Success => {}, # is a {http://www.w3.org/2001/XMLSchema}string EchoData => "example", }, ], # is a {http://www.w3.org/2001/XMLSchema}int Errors => 42 Show quoted text
> doesn't work either. My writer gets the unused tag warning, and only > the outer element <OTA_PingRS> is written.
And this is a reproducible bug as well. The choice expects a "Success" to be in the hash, and the sequence awaits a seq_Success. No chance in statisfying them both at a time. Working on it. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #34079] Problem with <xs:choice><xs:sequence>...</xs:sequence></xs:choice>
Date: Fri, 14 Mar 2008 16:02:14 +0000
To: bug-XML-Compile-SOAP [...] rt.cpan.org
From: Drew Taylor <drew [...] drewtaylor.com>
On 14 Mar 2008, at 14:37, Mark Overmeer via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=34079 > > > * Drew Taylor via RT (bug-XML-Compile-SOAP@rt.cpan.org) [080314 > 13:34]:
>> Following up to myself, I just read about the template functionality >> (marvelous idea!) and gave it a shot.
> > The best explanation of a schema is an example. People told me it > was undoable ;-)
I would have been one of those people! But it's incredibly useful, even if it has the occasional bug. :-) I'm lucky enough that I have a very full-featured schema to be working with, which I use to create the WSDL, which I use as input to XML::Compile so I never have to write XML. Hooray! Show quoted text
>> Unfortunately, the structure it suggests:
> > Wow... you have a nice concentration of complexities for me. It > already > resulted in two bugs in the example generation. This should look like > > # choice of seq_Success, Errors > > # sequence of Success, EchoData > # occurs 1 <= # <= 2 times > seq_Success => > [ { Success => {}, > > # is a {http://www.w3.org/2001/XMLSchema}string > EchoData => "example", }, > ], > > # is a {http://www.w3.org/2001/XMLSchema}int > Errors => 42
So the error is that the template's Success key should have an empty hashref instead of the empty string right? That's what I had to use to get my ping test working locally. Am I correct in saying that there's no actual error in the SOAP/WSDL implementation? Show quoted text
>> doesn't work either. My writer gets the unused tag warning, and only >> the outer element <OTA_PingRS> is written.
> > And this is a reproducible bug as well. The choice expects a > "Success" > to be in the hash, and the sequence awaits a seq_Success. No chance > in > statisfying them both at a time.
Ahhh, race conditions! As I get more familiar with the code base and continue implementing our API you'll probably be receiving patches/ bugs from me. Drew
We werelucky: I had plans to release today, and fixes for your report made it in on time. Just released as 0.70.