The way this has been working for me is:
If (file.schemaType().getName().getLocalPart().equals(ImageResource.type.ge tName().getLocalPart())) ImageResource imageResource = (ImageResource)file.changeType(ImageResource.type); Where file is an object of type AbstractResource and ImageResource extends AbstractResource (similar to your case of Type1 extending AbstractType) You could check your xmlbeans src to see what the class hierarchy is. ________________________________ From: Spike Mulligan [mailto:[EMAIL PROTECTED] Sent: Monday, June 11, 2007 9:55 AM To: [email protected] Subject: Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding Right so checking the schematype gives me the parent type and casting the parent type to the inheiriting type gives me a runtime exception. Have you ever gotten this to work? Do you think maybe my soap message or my xsd may be wrong? On 6/11/07, Mohana Ramaratnam <[EMAIL PROTECTED]> wrote: I think you can invoke the method schemaType to check the xsiType ________________________________ From: Spike Mulligan [mailto:[EMAIL PROTECTED] Sent: Monday, June 11, 2007 7:48 AM To: [email protected] Subject: Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding Okay, but how do I check at runtime whether its Type1 or Type2? On 6/11/07, Mohana Ramaratnam <[EMAIL PROTECTED] > wrote: You will have to use the method changeType and typecast the result back to the Type1 class. Mohana ________________________________ From: Spike Mulligan [mailto: [EMAIL PROTECTED] Sent: Monday, June 11, 2007 5:29 AM To: [email protected] Subject: AXIS2 + wsdl2java + XMLBeans not producing correct binding So I have a schema containing the following structure: AbstractType / \ / \ extension / \ Type1 Type2 When I send the service an instance of Type1 for example using xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java generated and which extends the AbstractType class). Instead it gives me a class of type AbstractType! Has anyone successfully done this? Does it work? Is this the expected behaviour of XML beans? What am I doing wrong?

