Hi,

currently I am confronted with some wired XMLBeans classpath issue during deserialisation of inherited types.

First of all the setup:

- Axis2-141, Tomcat 6, XMLBeans 2.3.0
- the web service is deployed as an aar containing a lib folder where all service related libraries are situated (especially the generated xbeans)
- the axis2/WEB-INF/lib folder contains just the default jars
- all the xbeans were generated separately by scomp and are located in a single jar - the service was generated using the "-Ewdc" switch and the dummy schemas are not included in the generated service jar (the jar actually only contains the Stub, the MessageReceivers, the Skeleton and several Faults (declared in the WSDL file))

So far so good. No problem at all, everything runs fine, except:

In our type xsds we have some inheritance (snippet):

[...]
<element name="UsernameIdentity" type="ia_types:UsernameIdentityType" substitutionGroup="ia_types:AttributedIdentity"/>
    <complexType name="UsernameIdentityType">
        <complexContent>
            <extension base="ia_types:AttributedIdentityType">
                <sequence>
                    <element name="username" type="string"/>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
    <complexType name="UsernameIdentityPropertyType">
        <sequence minOccurs="0">
            <element ref="ia_types:UsernameIdentity"/>
        </sequence>
    </complexType>

<element name="GroupIdentity" type="ia_types:GroupIdentityType" substitutionGroup="ia_types:AttributedIdentity"/>
    <complexType name="GroupIdentityType">
        <complexContent>
            <extension base="ia_types:AttributedIdentityType">
                <sequence>
                    <element name="groupname" type="string"/>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
    <complexType name="GroupIdentityPropertyType">
        <sequence minOccurs="0">
            <element ref="ia_types:GroupIdentity"/>
        </sequence>
    </complexType>

<element name="AttributedIdentity" type="ia_types:AttributedIdentityType" substitutionGroup="ia_types:Identity"/>
    <complexType name="AttributedIdentityType">
        <complexContent>
            <extension base="ia_types:IdentityType">
                <sequence>
<element name="attributes" type="ia_types:IdentityAttributesType"/>
                    <element name="identities">
                        <complexType>
                            <sequence>
<element ref="ia_types:AttributedIdentity" minOccurs="0" maxOccurs="unbounded"/>
                            </sequence>
                        </complexType>
                    </element>
                </sequence>
            </extension>
        </complexContent>
    </complexType>

    <element name="Identity" type="ia_types:IdentityType"/>
    <complexType name="IdentityType">
        <sequence>
            <element name="id" type="integer"/>
            <element name="origin" type="string"/>
<element name="refProfile" type="pms_types:ProfilePropertyType" minOccurs="0"/>
            <element name="active" type="boolean"/>
        </sequence>
    </complexType>
    <complexType name="IdentityPropertyType">
        <sequence minOccurs="0">
            <element ref="ia_types:Identity"/>
        </sequence>
    </complexType>
[...]

Now the service offers a request to create a new identity:

<element name="createIdentityRequest" type="ia_requests:createIdentityRequest"/>
    <complexType name="createIdentityRequest">
        <sequence>
            <element name="identity" type="ia_types:IdentityType"/>
        </sequence>
    </complexType>

If I send the following request:

<ns:createIdentityRequest xmlns:ns="http://www.enviromatics.net/WS/IdentityManagementAndAuthenticationService/requests/2.0 "
                                                  
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
<ns1:identity xmlns:ns1="http://www.enviromatics.net/WS/IdentityManagementAndAuthenticationService/requests/2.0 " xmlns:ns="http://www.enviromatics.net/WS/IdentityManagementAndAuthenticationService/types/2.0 "
                                
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://www.enviromatics.net/WS/IdentityManagementAndAuthenticationService/requests/2.0 "
                                xsi:type="ns:GroupIdentityType">
    <ns:id xsi:nil="true"/>
<ns:origin>http://127.0.0.1:8091/axis214/services/IdentityManagementAndAuthenticationService </ns:origin>
    <ns:refProfile/>
    <ns:active>false</ns:active>
    <ns:attributes xsi:type="ns:KeyVectorIdentityAttributesType"/>
    <ns:identities/>
    <ns:groupname>testGroup</ns:groupname>
  </ns1:identity>
</ns:createIdentityRequest>

which actually represents an instance of GroupIdentityType (see xsi:type="ns:GroupIdentityType") but XMLBeans parameter does not create an instance of GroupIdentityType(Impl) but of IdentityType(Impl) which cannot be cast (obviously). The funny thing about this is that if I place the xbeans jar in the axis2/WEB-INF/lib folder instead of the lib folder in the service aar XMLBeans parses an instance of GroupIdentityType(Impl) as it should.

Why does XMLBeans create only the basetype of an inheritance structure if the xbeans are located within the service aar and does work as expected if the xbeans are placed in axis2/WEB-INF/lib? I do not want any jar to be in the global axis2 classpath except the default ones so any help ist highly appreciated.

Thanks in advance.

Martin

Reply via email to