Loading ...
Sorry, an error occurred while loading the content.

Re: Element having minOccurs=0 and nillable=true

Expand Messages
  • bryondonahue
    Jim, I agree with the behavior you described. I sure would like to see this specified somewhere. Bryon ... otherwise ... schema ... have ... issue ... IMO ...
    Message 1 of 6 , Dec 8, 2003
    • 0 Attachment
      Jim,

      I agree with the behavior you described. I sure would like to see
      this specified somewhere.

      Bryon


      --- In soapbuilders@yahoogroups.com, Jim Murphy <jim.murphy@p...>
      wrote:
      > Well isn't this good timing...I'm cleaning up SOAPscope w.r.t. this
      > issue as we speak. :)
      >
      > The behavior I recently implemented for an unspecified value:
      >
      > 1. If the element was marked nillable use xsi:nil, otherwise
      > 2. If the element has minOccurs="0" don't serialize the element,
      otherwise
      > 3. If its a simpleType serialize an empty element
      >
      > so I've promoted nillablity a bit since it seems that its used to
      > specify extra semantics than just plain old minOccurs. If the
      schema
      > author went to all the trouble of using nillable, and its present I
      > should think in those terms. I admit its kind of arbitrary.
      >
      >
      > Jim Murphy
      > Mindreef, Inc.
      >
      >
      > bryondonahue wrote:
      >
      > > Wes,
      > >
      > > Thanks for the reply. There are a number of work arounds and we
      have
      > > already worked around this problem. My purpose for raising this
      issue
      > > in this forum is to get you folks thinking about this problem.
      IMO
      > > this is a problem that needs further attention and clarification,
      > > perhaps in WS-I?
      > >
      > > On the surface I agree with your statements, but I am not really
      > > satisfied. If I have an element with nillable=true and
      minOccurs=0
      > > and there is no value, is the element nil or not present? I guess
      I
      > > can understand the distinction between these two conditions if
      one is
      > > working at the XML level and can explicitly set the XML value and
      has
      > > some rules for distinguishing between these conditions.
      > >
      > > But, as you know, in WS toolkits, folks don't work at the XML
      level,
      > > they work at the programming model level and it seems that the
      > > programming models have different assumptions. I guess you could
      > > argue that in a SOAP Message both "no value" and xsi:nil=true are
      > > valid and it is the programming models responsibility to
      distinguish
      > > between these conditions, if this distinction is necessary.
      > >
      > > Most programming models do not, however, distinguish between "not
      > > present" and nil (ex: JAX-RPC) and work in the context of their
      > > assumptions. It seems that it is important to somehow specify the
      > > valid wire representations in this case and communicate them to
      the
      > > toolkit vendors. If this does not happen, we will be fighting
      this
      > > problem for a long time.
      > >
      > > Based on this experience, I have already changed our corporate
      best
      > > practice to disallow the use of nillable=true in WSDL. I hate to
      do
      > > this, but we don't want to deal with problems of this nature; we
      kind
      > > of hope that you folks and WS-I will deal with them for us.
      > >
      > > Additionally, I have contacted our suppliers and asked them to
      clean
      > > up their act.
      > >
      > > Thanks again. I appreciate the good work that you and others are
      > > doing here.
      > >
      > > Bryon
      > >
      > >
      > > --- In soapbuilders@yahoogroups.com, Wes Moulder <wes@w...> wrote:
      > >
      > >>Present and having no value is distinctly different from nilled
      > >
      > > out.
      > >
      > >>Think of it in terms of your programming language of choice: ""
      vs
      > >>null. As far as a data model goes, there is no difference
      between
      > >>optional versus nillable, unless you want to go into the whole
      > >
      > > partially
      > >
      > >>transmitted array territory of having optional and omitted as
      > >
      > > meaning
      > >
      > >>"leave the value as it was before", but that gets into the whole
      > >
      > > mess of
      > >
      > >>assuming aspects of the data model on the other side. Given
      that,
      > >
      > > then,
      > >
      > >>I'd expect explicitly nilled values would react the same as
      omitted
      > >>values (IE: both would map to a null value in your higher layer
      of
      > >>abstraction.
      > >>
      > >>One thing for Byron: there are still tools out there that don't
      > >
      > > handle
      > >
      > >>minOccurs=0 very well. is it possible to try the WSDL without the
      > >>nillable="true", and see if it works that way with an optional
      > >
      > > value?
      > >
      > >>--Wes
      > >>
      > >>Dinesh Shahane wrote:
      > >>
      > >>
      > >>>IMO Both forms of the XML should be accepted. If the element
      > >>><varString> is present and has no value, it should look for
      > >
      > > xsi:nil
      > >
      > >>>attribute before generating an error.
      > >>>If the element is not sent, it should still accept it due to
      > >>>"minOccurs" constraint. Probably the tools generating the SOAP
      > >
      > > are not
      > >
      > >>>capable of understanding the difference between "optional" and
      > >>>"nillable", this may be due to the lack of these concepts in the
      > >
      > > base
      > >
      > >>>programming platform. Pure XML tools should let you choose the
      > >
      > > form you
      > >
      > >>>like.
      > >>>
      > >>>Dinesh
      > >>>
      > >>> -----Original Message-----
      > >>> *From:* bryondonahue [mailto:bryondonahue@y...]
      > >>> *Sent:* Monday, December 08, 2003 6:38 AM
      > >>> *To:* soapbuilders@yahoogroups.com
      > >>> *Subject:* [soapbuilders] Element having minOccurs=0 and
      > >
      > > nillable=true
      > >
      > >>> Folks,
      > >>>
      > >>> I'm experiencing an interoperability problem related to
      > >
      > > minOccurs=0
      > >
      > >>> and nillable=true. Suppose I have the following associated
      > >
      > > with a
      > >
      > >>> doc/lit WSDL:
      > >>>
      > >>> <s:complexType name="echoMeStructRequest">
      > >>> <s:sequence>
      > >>> <s:element minOccurs="0" nillable="true" maxOccurs="1"
      > >>> name="varString" type="s:string" />
      > >>> <s:element minOccurs="0" nillable="true" maxOccurs="1"
      > >>> name="varInt" type="s:int" />
      > >>> <s:element minOccurs="0" nillable="true" maxOccurs="1"
      > >>> name="varFloat" type="s:float" />
      > >>> </s:sequence>
      > >>> </s:complexType>
      > >>> <s:element name="theStruct" type="tns:echoMeStructRequest" />
      > >>>
      > >>> Now suppose I must send theStruct in a SOAP message and
      > >
      > > varString has
      > >
      > >>> no value. The question is what should be sent on the wire?
      > >>>
      > >>> Is it valid not to send the varString tag, due to
      > >
      > > minOccurs="0"? Or,
      > >
      > >>> does nillable="true" require that the varString be present
      > >
      > > with the
      > >
      > >>> attribute xsi:nill="true"? Or, are both forms acceptable?
      > >>>
      > >>> I have one product that, when there is no value, requires
      the
      > >
      > > tag on
      > >
      > >>> the wire with xsi:nil="true" and always puts this tag on the
      > >
      > > wire. I
      > >
      > >>> have another product that can consume either form but, when
      > >
      > > emitting
      > >
      > >>> messages, does not, by default, put the tag on the wire; but
      > >>> interestingly, if the programmer calls a Java Bean setter
      and
      > >
      > > passes
      > >
      > >>> null (example theStruct.setVarString(null)), the product
      will
      > >
      > > then
      > >
      > >>> put the varString tag on the wire with xsi:nill="true".
      > >>>
      > >>> Can you folks provide insight and reasoning as to to what
      > >
      > > should be
      > >
      > >>> on the wire? Note that I have examined the archive and your
      > >
      > > test
      > >
      > >>> suites; it appears this issue has not been addressed.
      > >>>
      > >>> Thanks,
      > >>>
      > >>> Bryon
      > >>> AT&T
      > >>>
      > >>>
      > >
      > >
      > >
      > >
      > > -----------------------------------------------------------------
      > > This group is a forum for builders of SOAP implementations to
      discuss implementation and interoperability issues. Please stay on-
      topic.
      > >
      > > To unsubscribe from this group, send an email to:
      > > soapbuilders-unsubscribe@yahoogroups.com
      > >
      > >
      > >
      > > Your use of Yahoo! Groups is subject to
      http://docs.yahoo.com/info/terms/
      > >
      > >
      > >
      > >
      > >
    Your message has been successfully submitted and would be delivered to recipients shortly.