Forum: Ruby on Rails ActionWebService::Struct --> minOccurs?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
brian (Guest)
on 2006-01-22 23:49

In extending ActionWebService::Struct and naming members, is it possible
to indicate them as optional (yielding minOccurs="0" in the wsdl)? For
example, suppose I want to create a request object that can either work
via a number id or a string name (think of it as a union).

class Identifier < ActionWebService::Struct
  member :id, :int
  member :name, :string

&gt;xsd:complexType name="Identifier"&lt;
    &gt;xsd:element name="id" type="xsd:int"/&lt;
    &gt;xsd:element name="name" type="xsd:string"/&lt;

but I want something like:

&gt;xsd:complexType name="Identifier"&lt;
    &gt;xsd:element name="id" type="xsd:int" minOccurs="0"
    &gt;xsd:element name="name" type="xsd:string" minOccurs="0"

And when I receive my Identifier object in code, I can call to know if a member was specified.

I don't think this is possible, but I thought I'd ask. :^)

This topic is locked and can not be replied to.