users@jax-rpc.java.net

WSDL: schema minOccurs="0", maxOccurs="unbounded", ...

From: Pedro Salazar <pedro-b-salazar_at_PTINOVACAO.PT>
Date: Fri, 28 Mar 2003 10:43:57 +0000

Greetings,

I think it's not possible to define a message parameter that is optional
(like the 'minOccurs="0"' in element schema). So, the only workaround is
to wrap the element in another element and make that the occurrences of
that element may be 0 (zero).

<schema>
<element name="WrapElement" type="WrapElementType" />
<complexType name="WrapElementType">
    <sequence>
        <element name="parameter" type="string"
                minOccurs="0" maxOcurrs="1"/>
    </sequence>
</complexType>
</schema>

<message name="myMessage">
        <part name="parameter" element="ns2:WrapElement"/>
</message>

But, how Java mapping handle the 0 occurrences of one element? How
should we know that the element could be 0? It only matters for the SOAP
message and the Java part the object exists always even if it is null?

If the minim occurrences would be 1, it means if I try to pass a object
a null I would get a exception on the binding?

And the maxOccurs?

thanks,
Pedro Salazar.
--
PS
pedro-b-salazar_at_ptinovacao.pt
PGP:0E129E31D803BC61