You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Cory Wilkerson <cw...@travelnow.com> on 2003/09/04 05:26:01 UTC

RE: why oh why - soapenc & minOccurs -- some resolution!

Aha -- because if the minOccurs attribute = 0, then Axis replaces the qname that woulda been "xsd:int" (where xsd = http://www.w3.org/2001/XMLSchema) with "soapenc:int" (where soapenc = http://schemas.xmlsoap.org/soap/encoding/).  This all takes place in org.apache.axis.wsdl.symbolTable#getNillableQName -- it appears that the Axis developers are coupling the concept of nillable and minOccurs = 0 as per this comment from the source:

                    // If we have a minoccurs="0"/maxoccurs="1", this is just
                    // like a nillable single value, so treat it as such.

I don't mean to drag everyone into this, but is that correct?  If the thing *doesn't* occur, I suppose it could be represented as xs:nil, but, seeing as how Axis is generating this from WSDL that clearly states the type is of type "xsd:int" -- I don't think the the toolkit should be making judgments as to whether or not it can swap in/out namespaces.  After all, the server side will most likely be expecting to see a value from the xsd namespace.

The issue gets further muddied when you consider that the soapenc's (http://schemas.xmlsoap.org/soap/encoding/.) representation of int is just a restriction on xsd's int (http://www.w3.org/2001/XMLSchema).  

I guess this is one of the reasons the ws-i people put their collective foot down.  
Cory


-----Original Message-----
From: Cory Wilkerson [mailto:cwilkerson@travelnow.com] 
Sent: Wednesday, September 03, 2003 5:20 PM
To: axis-user@xml.apache.org
Subject: why oh why - soapenc & minOccurs


All,

Does anyone have any input as to why, when given schema such as the
following:

<wsdl:types>
	<xsd:schema targetNamespace="http://www.foo.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">	
		<xsd:element name="foo">
			<xsd:complexType>
				<xsd:sequence>
					<xsd:element name="bar"
type="xsd:int" minOccurs="0"/>
				</xsd:sequence>
			</xsd:complexType>
		</xsd:element>
	</xsd:schema>
<wsdl:types>

WSDL2Java generates code that indicates that bar is of type "int" as
defined in the "http://schemas.xmlsoap.org/soap/encoding/" namespace?  I
am bewildered.  If I remove the minOccurs attribute, Axis will generate
the correct stub.

Sorry for a quasi-repost -- perhaps I didn't phrase my original issue
well or no one knew the answer ;).

Thanks,
Cory Wilkerson

Re: why oh why - soapenc & minOccurs -- some resolution!

Posted by Ben Butchart <b....@cs.ucl.ac.uk>.
Cory,

Another thing that confuses me about that comment you quoted is the way
maxOccurs=1 is treated.

                    // If we have a minoccurs="0"/maxoccurs="1", this is
just
                    // like a nillable single value, so treat it as such.


But if you had:

<xsd:sequence>
 <xsd:element name="bar" type="xsd:int" maxOccurs="2"/>
</xsd:sequence>

I would expect wsdl2java to generate code that maps "bar" to an array of
integers with array length of 2. Is that right ? If so, why should it be
different for an array of length 1 ?


Ben




----- Original Message -----
From: "Cory Wilkerson" <cw...@travelnow.com>
To: "axis-user" <ax...@xml.apache.org>
Sent: Thursday, September 04, 2003 4:26 AM
Subject: RE: why oh why - soapenc & minOccurs -- some resolution!


Aha -- because if the minOccurs attribute = 0, then Axis replaces the qname
that woulda been "xsd:int" (where xsd = http://www.w3.org/2001/XMLSchema)
with "soapenc:int" (where soapenc =
http://schemas.xmlsoap.org/soap/encoding/).  This all takes place in
org.apache.axis.wsdl.symbolTable#getNillableQName -- it appears that the
Axis developers are coupling the concept of nillable and minOccurs = 0 as
per this comment from the source:

                    // If we have a minoccurs="0"/maxoccurs="1", this is
just
                    // like a nillable single value, so treat it as such.

I don't mean to drag everyone into this, but is that correct?  If the thing
*doesn't* occur, I suppose it could be represented as xs:nil, but, seeing as
how Axis is generating this from WSDL that clearly states the type is of
type "xsd:int" -- I don't think the the toolkit should be making judgments
as to whether or not it can swap in/out namespaces.  After all, the server
side will most likely be expecting to see a value from the xsd namespace.

The issue gets further muddied when you consider that the soapenc's
(http://schemas.xmlsoap.org/soap/encoding/.) representation of int is just a
restriction on xsd's int (http://www.w3.org/2001/XMLSchema).

I guess this is one of the reasons the ws-i people put their collective foot
down.
Cory


-----Original Message-----
From: Cory Wilkerson [mailto:cwilkerson@travelnow.com]
Sent: Wednesday, September 03, 2003 5:20 PM
To: axis-user@xml.apache.org
Subject: why oh why - soapenc & minOccurs


All,

Does anyone have any input as to why, when given schema such as the
following:

<wsdl:types>
<xsd:schema targetNamespace="http://www.foo.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="bar"
type="xsd:int" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<wsdl:types>

WSDL2Java generates code that indicates that bar is of type "int" as
defined in the "http://schemas.xmlsoap.org/soap/encoding/" namespace?  I
am bewildered.  If I remove the minOccurs attribute, Axis will generate
the correct stub.

Sorry for a quasi-repost -- perhaps I didn't phrase my original issue
well or no one knew the answer ;).

Thanks,
Cory Wilkerson