[Xml-compile] bug(s) in compilation of a "choice" element?

Oliver Gorwits oliver.gorwits at oucs.ox.ac.uk
Fri Feb 5 21:51:39 GMT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I thought I'd quickly post to the list what I think might be a bug,
but could equally simply be me being new to this SOAP business...

I have the following in the .xsd files[1]:

  <xs:element name="ParentFolderIds"
type="t:NonEmptyArrayOfBaseFolderIdsType"/>

  <xs:complexType name="NonEmptyArrayOfBaseFolderIdsType">
    <xs:choice maxOccurs="unbounded" minOccurs="1">
      <xs:element name="FolderId" type="t:FolderIdType"/>
      <xs:element name="DistinguishedFolderId"
type="t:DistinguishedFolderIdType"/>
    </xs:choice>
  </xs:complexType>

Which I believe should accept the following Perl data structure:

ParentFolderIds => {
  cho_DistinguishedFolderId => [{
	Id => 'contacts',
        Mailbox => { EmailAddress => 'nobody at example.com' }
  }],
}

On first attempt, XML::Compile complains thus:

error: too few blocks for `cho_FolderId' specified, got 0 need 1 at...

Which I think is incorrect as the <xs:choice> means I can provide
cho_DistinguishedFolderId instead of cho_FolderId. Possible bug
number one?

So then I just comment out the FolderId <xs:element> and try again.
This call *compiles successfully* and is sent to the server, but
with the following XML representation in the SOAP request:

<tns:ParentFolderIds/>

I.e. it's empty; bug number two (or extension of #1)? I think the
SOAP request should probably contain something like this, instead:

<tns:ParentFolderIds>
  <t:DistinguishedFolderId Id="contacts">
    <t:Mailbox>
      <t:EmailAddress>nobody at example.com</t:EmailAddress>
    </t:Mailbox>
  </t:DistinguishedFolderId>
</tns:ParentFolderIds>

My apologies if my inexperience with SOAP and XML has caused
confusion, in that case I'd appreciate some guidance!

regards,
oliver.

[1] this is Microsoft Exchange Web Services, which I can report
works fine with XML::Compile if the above problem is hacked around.
- -- 
Oliver Gorwits, Network and Telecommunications Group,
Oxford University Computing Services
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktskusACgkQ2NPq7pwWBt4dpACgrMCivK1Bc60fJbRdhQiUO6DO
8uIAnjAfXcZMI7mMpQgRWn+bpKmxPDDY
=b+Gj
-----END PGP SIGNATURE-----



More information about the Xml-compile mailing list