axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Wisnovsky (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Commented: (AXIS-2155) Cannot distinguish "element not present" and "element present and nil"
Date Thu, 04 Aug 2005 17:15:42 GMT
    [ http://issues.apache.org/jira/browse/AXIS-2155?page=comments#action_12317654 ] 

Peter Wisnovsky commented on AXIS-2155:
---------------------------------------

I'm not sure what you mean.

.NET doesn't generate a separate class, just an extra indicator attribute in the owning class.
So

<complexType name="A">
 ...
 <element name="a" type="xs:int" nillable="true" minOccurs="0"/>
 <element name="b" type="xs:int" nillable="true" minOccurs="1"/>
 <element name="c" type="xs:int" nillable="false" minOccurs="0"/>
 <element name="d" type="xs:int" nillable="false" minOccurs="1"/>
...
</complexType>

Would correspond in Java to

class A
{
Integer a;
boolean aSpecified;
int b;
Integer c; // Per jaxrpc1.1fr spec p33, though with a separate indicator this could in fact
be an int. Oh for autoboxing.
boolean cSpecified;
int d;
}

Anyone doing reflection on the class and assuming all attrs correspond to elements would indeed
have a problem. But if it were done this way we are not creating a bean holder class for these
attrs. Was that your concern?

One could also imagine using the object-null semantic to mean unspecified and use a null indicator
for "is null" -- this would be more SQL-like, where a host var is never set if it wasn't bound
to a projected column.

> 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


Mime
View raw message