1. Schema:
<!-- Define global  elements -->
<xs:element name="gBooleanNillable" type="xs:boolean" nillable="true"/>

<!-- Refer global elements -->
<xs:complexType name="MyOperationRequest_Type">
                <xs:sequence>
                        <xs:element ref="gBooleanNillable"/>
                </xs:sequence>
</xs:complexType>

2. wsdl2java testing

With AXIS1.2 RC1 wsdl2java, a java.lang.Boolean class will be generated
.

org.apache.axis.wsdl.symbolTable.DefinedElement
QName:
{http://service.wellsfargo.com/provider/ecpr/prototype/myOperation/2007/
}gBooleanNillable
name:          java.lang.Boolean
isReferenced?  true
Class:         org.apache.axis.wsdl.symbolTable.DefinedElement
Base?:         true
Undefined?:    false
isSimpleType?  false
Node:          [xs:element: null]
Dims:          
RefType:
  QName:         {http://schemas.xmlsoap.org/soap/encoding/}boolean
  name:          java.lang.Boolean
  isReferenced?  true
  Class:         org.apache.axis.wsdl.symbolTable.BaseType
  Base?:         true
  Undefined?:    false
  isSimpleType?  false
  Node:          null
  Dims:          
  RefType:       null 

With AXIS1.4 wsdl2java, NO java.lang.Boolean class will be generated.

org.apache.axis.wsdl.symbolTable.DefinedElement
QName:
{http://service.wellsfargo.com/provider/ecpr/prototype/myOperation/2007/
}gBooleanNillable
name:          boolean
isReferenced?  true
Class:         org.apache.axis.wsdl.symbolTable.DefinedElement
Base?:         true
Undefined?:    false
isSimpleType?  false
Node:          [xs:element: null]
Dims:          
isOnlyLiteralReferenced: false
RefType:
  QName:         {http://www.w3.org/2001/XMLSchema}boolean
  name:          boolean
  isReferenced?  true
  Class:         org.apache.axis.wsdl.symbolTable.BaseType
  Base?:         true
  Undefined?:    false
  isSimpleType?  false
  Node:          null
  Dims:          
  isOnlyLiteralReferenced: false
  RefType:       null 

3. The problem is that AXIS 1.4 wsdljava does not create Boolean wrapper
class for the element with nillable=true. This does not follow JAX-RPC
1.1 standard.


4. What I found.
I found that AXIS 1.4 did not retrieve the attribute of ref element.  In
fact, 
I found following code were commented out in the method
getTypeQNameFromAttr of org.apache.axis.wsdl.symbolTable.utils.java
(AXIS 1.4)

   // An alternate qname is returned if nillable
   //     if (typeAttrName.equals("type")) {
   //         if (JavaUtils.isTrueExplicitly(getAttribute(node,
"nillable"))) {
   //             qName = getNillableQName(qName);
   //         }
   //   }

Based on my understand, this code is needed.

5. What I did
I uncommented out above code and put back the method
"getNillableQName(qName)" (from AXIS 1.2).
Testing proved it fixed my problem
/**
     * getNillableQName returns the QName to use if the nillable=true
     * attribute is used.                             
     * For example, in JAX-RPC:
     *   The QName "xsd:int" maps to a java int.
     *   However if an element with a type="xsd:int" also has the 
     *   "nillable=true" attribute, the type should be an Integer (not
an int).
     *   So in these circumstances, this routine is called with xsd:int
to 
     *   get a suitable qname (soapenc:int) which maps to Integer.
     * @param qName QName
     */
    public static QName getNillableQName(QName qName) {
        QName rc = qName;
        if (Constants.isSchemaXSD(rc.getNamespaceURI())) {
            String localName = rc.getLocalPart();
            if (localName.equals("int") ||
                    localName.equals("long") ||
                    localName.equals("short") ||
                    localName.equals("float") ||
                    localName.equals("double") ||
                    localName.equals("boolean") ||
                    localName.equals("byte"))
            {
                rc = findQName(Constants.URI_DEFAULT_SOAP_ENC,
                               qName.getLocalPart());
            }
            else if (localName.equals("base64Binary"))
             {
                rc = findQName(Constants.URI_DEFAULT_SOAP_ENC,
"base64");
            } else if (localName.equals("hexBinary")) {
                rc = findQName(Constants.URI_DEFAULT_SCHEMA_XSD,
"hexBinary");
            }
        }
       return rc;
  }

6. My question
Does anyone know the reason we commentted above code ?

Since I do not fully understand wsdl2java changes for AXIS 1.4 yet, I
will really appreciate that anyone points out the issue of doing that.
Thanks in advance.


Neng Xu 
WellsFargo Services Company; ECBS 
225 2nd Ave. S. Mpls, MN 55479 
Phone (612) 667-6489; Fax:(612) 667-8092 
MAC: N9301-028 





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to