You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by R J Scheuerle Jr <sc...@us.ibm.com> on 2002/03/18 16:22:14 UTC

Re: SimpleTypes is "broken" (comments please !)

I need some comments on this!

Rich Scheuerle
XML & Web Services Development
512-838-5115  (IBM TL 678-5115)


                                                                                                                            
                      R J Scheuerle                                                                                         
                      Jr/Austin/IBM@IBM        To:       axis-dev@xml.apache.org                                            
                      US                       cc:                                                                          
                                               Subject:  SimpleTypes is "broken"                                            
                      03/15/2002 04:27                                                                                      
                      PM                                                                                                    
                      Please respond to                                                                                     
                      axis-dev                                                                                              
                                                                                                                            
                                                                                                                            



If a simpleType is defined in the wsdl file.  For example:

      <xsd:simpleType name="simple">
        <xsd:restriction base="xsd:string" />
      </xsd:simpleType>

WSDL2Java maps all references of the simpleType to the base type (in this
case java.lang.String).

WSDL2Java also emits typeMapping registrations in the stub and deploy
files.  Here is the deploy file
typeMapping:

      <typeMapping
        xmlns:ns="urn:comprehensive-types.types.wsdl.test"
        qname="ns:simple"
        type="java:java.lang.String"
        serializer
="org.apache.axis.encoding.ser.SimpleNonPrimitiveSerializerFactory"
        deserializer
="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      />

The problem is that this has the unfortunate side effect of serializing ALL
java.lang.String objects
as type "ns:simple"...which is definitely wrong!

----------------------------------------
One alternative is to treat the case of

      <xsd:simpleType name="simple">
        <xsd:restriction base="xsd:string" />
      </xsd:simpleType>

just like:

 <xsd:complexType name="simple">
   <xsd:simpleContent>
      <xsd:extension base="xsd:string" />
   </xsd:simpleContent>
<xsd:complexType/>

This would solve the over-the-wire problem, but would have the side effect
of generating a Simple.java
class to represent the simpleType.
---------------------------------------------

Comments?

Rich Scheuerle
XML & Web Services Development
512-838-5115  (IBM TL 678-5115)