[ http://issues.apache.org/jira/browse/AXIS-2155?page=comments#action_12330673 ]
Juha Kononen commented on AXIS-2155: ------------------------------------ Hi, here's my email which I sent to the axis-user mail list. "I have a problem with developing an Axis-based system which should be prepared for missing elements and null values. My schema is prepared for that by using the minOccurs="0" and maxOccurs="1" attributes (I think it's a better solution than using nillable attributes). But it seems that Axis (1.2.1 Final) don't make any difference between these attributes. WSDL2Java creates an elemField.setMinOccurs(0) statement when minOccurs="0" is used but nothing when minOccurs="1" or greater. Is this a bug? Isn't Axis should give an error if I did't sent a particular element required by the schema? Or is there something I don't understand?" Would it possible if Axis just checked (against the schema) whether the xml structure sent can be without particular elements or not (by checking, for example, the minOccurs="0" and minOccurs="1" attributes)? So if I don't send a particular element which must be sent in according to the schema Axis will give an error message. On the other hand, if I send an element without any subelements (in according to the schema) the equivalent classes of those subelements are simply nulls and it's easy to make null checks in server-side code. Where do we actually need nillable attributes if we can just drop off the elements we don't want to sent? I hope I am talking about the same thing :) Thanks Juha > Cannot distinguish "element not present" and "element present and nil" > ---------------------------------------------------------------------- > > Key: AXIS-2155 > URL: http://issues.apache.org/jira/browse/AXIS-2155 > Project: Apache Axis > Type: Bug > Components: Serialization/Deserialization > Versions: 1.2.1 > Environment: Windows XP > Reporter: Peter Wisnovsky > Priority: Critical > Attachments: simple_axis.zip > > I have a web service where I need to distinguish between "a value was not > sent" and "a value was sent and is nil", both to and from the server. If I > have an element of a complex type with a subelement where nillable="true" and > minOccurs="0" AXIS generates the attribute of the Java class, but there seems > to be no way to indicate for > <xs:complexType name="ResourceType"> > <xs:complexContent> > <xs:extension base="pvOperational:PersonType"> > <xs:sequence> > .. > <xs:element name="employerRef" type="pvOperational:AgencyReferenceType" > minOccurs="0" nillable="true"/> > that I want no employerRef or a nil employerRef, e.g. > <resource> > <employerRef xsi:nil="true"/> > </resource> > versus > <resource/> > In either case all I see in the proxy is an attribute employerRef that might > or might not be null. > Is this supported? JaxRPC is admittedly unclear on the point as the only > issue it discusses is the use of Java holder classes for primitives for > either minOccurs=0 OR nillable=true and does not discuss minOccurs=0 AND > nillable=true, but it seems pretty fundamental if you are dealing with > database-based services to have null indicators. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira