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:[EMAIL PROTECTED] 
Sent: Wednesday, September 03, 2003 5:20 PM
To: [EMAIL PROTECTED]
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

Reply via email to