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:       [EMAIL PROTECTED]       
                                     
                      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)




Reply via email to