users@jax-rpc.java.net

Extension of complex types

From: Sapozhnikov Michael <msapozhnikov_at_AXSONE.COM>
Date: Fri, 03 May 2002 13:14:46 -0600

Hi,
I have problems with extesion of complex type:

  <complexType name="UserContextType">
    <sequence>
      <element name="SYS_USER" minOccurs="0" type="string"/>
      <element name="GROUP_ID" minOccurs="0" type="string"/>
      <element name="DBMAP" minOccurs="0" type="string"/>
      <element name="ENTITY" type="string" minOccurs="0"/>
    </sequence>
  </complexType>

<!-- this does not work -->
  <complexType name="UserRequestType">
    <complexContent>
      <extension base="tns:UserContextType">
        <sequence>
          <element name="HOST_USER" type="string" minOccurs="0"/>
          <element name="HOST_PWD" type="string" minOccurs="0"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

<!-- below works, but I need to reuse types -->

  <complexType name="UserRequestType">
     <sequence>
        <element name="SYS_USER" minOccurs="0" type="string"/>
        <element name="GROUP_ID" minOccurs="0" type="string"/>
        <element name="DBMAP" minOccurs="0" type="string"/>
        <element name="ENTITY" type="string" minOccurs="0"/>
        <element name="HOST_USER" type="string" minOccurs="0"/>
        <element name="HOST_PWD" type="string" minOccurs="0"/>
     </sequence>
  </complexType>

I read spec and it says (Appendix: XML Schema support) that derivation of complex Types by extension is required in JAX-RPC 1.0.
My example matches example provided for complex type "Address" and its extension "USAddress", but it does not work. Is something wrong in my code or this is just a bug in RI?

BTW, example provided uses unsupported type: zip element in USAddress is defined as
<element name="zip" type="positiveInteger"/>
but positiveInteger is not a supported XML type.

This brings me to another question:
How to use positiveInteger, NonNegativeInteger, etc if
derivation of new simple types by restriction of an existing simple type is optional and derivation of complex type from a simple type is also optional (and as a matter of fact they are not implemented in RI)?

What is a suggested way of implementing these types, or we just have to avoid them until they will be implemented?

Any help greatly appreciated.

Thanks,
Michael