ActionWebService::Struct --> minOccurs?


#1

Howdy,

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
end

>xsd:complexType name=“Identifier”<
>xsd:all<
>xsd:element name=“id” type=“xsd:int”/<
>xsd:element name=“name” type=“xsd:string”/<
>>/xsd:all<
>/xsd:complexType<

but I want something like:

>xsd:complexType name=“Identifier”<
>xsd:all<
>xsd:element name=“id” type=“xsd:int” minOccurs=“0”
maxOccurs=“1”/<
>xsd:element name=“name” type=“xsd:string” minOccurs=“0”
maxOccurs=“1”/<
>/xsd:all<
>/xsd:complexType<

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

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

Thanks,
Brian