Right--when I try to do that I get a classcastexception when I use the
inheiriting class.  When I use the abstract parent class then gives me the
name of the element.

I do:
  addDevice.getAddDevice
().getAddDeviceInputParam().getAbstractAttributeSet().schemaType().getName().getLocalPart())

The result is a classcastexception in getAbstractAttributeSet() in the line
target = 
(com.nds.consumermgr.types.AbstractAttributeSetType)get_store().find_element_user(ABSTRACTATTRIBUTESET$3,
0);

So for some reason it doesn't know to get the inheiriting type.

Any ideas?


I'm attaching my schema and my sample soap request--maybe you'll see what
I'm doing wrong.


On 6/11/07, Mohana Ramaratnam <[EMAIL PROTECTED]> wrote:

 The way this has been working for me is:



If (file.schemaType().getName().getLocalPart().equals(
ImageResource.type.getName().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:* user@xmlbeans.apache.org
*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:* user@xmlbeans.apache.org
*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:* user@xmlbeans.apache.org
*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?





<xs:schema xmlns:types="http://consumermgr.sss.com/types"; xmlns:cm="http://consumermgr.sss.com/consumermgr"; xmlns:stb="http://consumermgr.sss.com/STB"; xmlns:vgk="http://consumermgr.sss.com/VGKey"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; targetNamespace="http://consumermgr.sss.com/consumermgr"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:import namespace="http://consumermgr.sss.com/STB"; schemaLocation="STB.xsd"/>
	<xs:import namespace="http://consumermgr.sss.com/VGKey"; schemaLocation="VGKey.xsd"/>
	<xs:import namespace="http://consumermgr.sss.com/types"; schemaLocation="types.xsd"/>
	<xs:element name="SampleDeviceAddRequest" type="cm:DeviceAddRequest"/>
	<xs:complexType name="DeviceAddRequest">
		<xs:sequence>
			<xs:element name="deviceId" type="types:id_Type"/>
			<xs:element ref="types:AbstractAttributeSet"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="DeviceAddResponse">
		<xs:sequence>
			<xs:element ref="cm:responseHeader"/>
			<xs:element name="response" type="cm:StandardResponseBodyType"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="StandardResponseBodyType">
		<xs:sequence>
			<xs:element ref="cm:responseCode"/>
			<xs:element ref="cm:errorDescription" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="errorDescription" type="cm:errorDescription_Type"/>
	<xs:simpleType name="errorDescription_Type">
		<xs:restriction base="xs:string"/>
	</xs:simpleType>
	<xs:element name="responseCode" type="cm:responseCode_Type"/>
	<xs:simpleType name="responseCode_Type">
		<xs:restriction base="xs:string"/>
	</xs:simpleType>
	<xs:element name="responseHeader" type="cm:responseHeader_Type"/>
	<xs:complexType name="DeviceId_Type">
		<xs:sequence>
			<xs:element name="idType" type="types:idType_Type"/>
			<xs:element name="id" type="types:id_Type"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="responseHeader_Type">
		<xs:all>
			<xs:element name="timestamp" type="types:DateTime_Type"/>
		</xs:all>
	</xs:complexType>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; xmlns="http://schemas.xmlsoap.org/wsdl/"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; xmlns:y="http://consumermgr.sss.com"; xmlns:types="http://consumermgr.sss.com/types"; xmlns:cm="http://consumermgr.sss.com/consumermgr"; xmlns:stb="http://consumermgr.sss.com/STB"; xmlns:vgk="http://consumermgr.sss.com/VGKey"; targetNamespace="http://consumermgr.sss.com";>
	<types/>
	<types/>
	<types>
		<xs:schema xmlns:types="http://consumermgr.sss.com/types"; xmlns:cm="http://consumermgr.sss.com/consumermgr"; xmlns:stb="http://consumermgr.sss.com/STB"; xmlns:vgk="http://consumermgr.sss.com/VGKey"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; targetNamespace="http://consumermgr.sss.com/skeleton"; elementFormDefault="qualified" attributeFormDefault="unqualified">
			<xs:import namespace="http://consumermgr.sss.com/consumermgr"; schemaLocation="ConsumerManager.xsd"/>
		</xs:schema>
	</types>
	<message name="addDeviceRequest">
		<part name="addDeviceInputParam" type="cm:DeviceAddRequest"/>
	</message>
	<message name="addDeviceResponse">
		<part name="addDeviceOuputParam" type="cm:DeviceAddResponse"/>
	</message>
	<portType name="ConsumerMgrPort">
		<operation name="addDevice">
			<input message="y:addDeviceRequest"/>
			<output message="y:addDeviceResponse"/>
		</operation>
	</portType>
	<binding name="ConsumerMgrBinding" type="y:ConsumerMgrPort">
		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
		<operation name="addDevice">
			<input>
				<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://consumermgr.sss.com"/>
			</input>
			<output>
				<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://consumermgr.sss.com"/>
			</output>
		</operation>
	</binding>
	<service name="ConsumerMgrService">
		<port name="ConsumerMgrPort" binding="y:ConsumerMgrBinding">
			<soap:address location="http://consumermgr.sss.com"/>
		</port>
	</service>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:types="http://consumermgr.sss.com/types"; xmlns:cm="http://consumermgr.sss.com/consumermgr"; xmlns:stb="http://consumermgr.sss.com/STB"; xmlns:vgk="http://consumermgr.sss.com/VGKey"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; targetNamespace="http://consumermgr.sss.com/STB"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:import namespace="http://consumermgr.sss.com/types"; schemaLocation="types.xsd"/>
	<xs:element name="STBAttributeSet" type="stb:STBAttributeSet_Type" substitutionGroup="types:AbstractAttributeSet"/>
	<xs:complexType name="STBAttributeSet_Type">
		<xs:complexContent>
			<xs:extension base="types:AbstractAttributeSet_Type">
				<xs:sequence>
					<xs:element ref="types:password"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:types="http://consumermgr.sss.com/types"; xmlns:cm="http://consumermgr.sss.com/consumermgr"; xmlns:stb="http://consumermgr.sss.com/STB"; xmlns:vgk="http://consumermgr.sss.com/VGKey"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; targetNamespace="http://consumermgr.sss.com/types"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="AbstractAttributeSet" type="types:AbstractAttributeSet_Type"/>
	<xs:complexType name="AbstractAttributeSet_Type" abstract="true"/>
	<xs:element name="pin" type="types:pin_Type"/>
	<xs:complexType name="pin_Type">
		<xs:simpleContent>
			<xs:extension base="xs:int"/>
		</xs:simpleContent>
	</xs:complexType>
	<xs:element name="password" type="types:password_Type"/>
	<xs:complexType name="password_Type">
		<xs:simpleContent>
			<xs:extension base="xs:string"/>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="idType_Type">
		<xs:simpleContent>
			<xs:extension base="xs:string"/>
		</xs:simpleContent>
	</xs:complexType>
	<xs:simpleType name="DateTime_Type">
		<xs:restriction base="xs:dateTime"/>
	</xs:simpleType>
	<xs:complexType name="id_Type">
		<xs:simpleContent>
			<xs:extension base="xs:string"/>
		</xs:simpleContent>
	</xs:complexType>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:types="http://consumermgr.sss.com/types"; xmlns:cm="http://consumermgr.sss.com/consumermgr"; xmlns:stb="http://consumermgr.sss.com/STB"; xmlns:vgk="http://consumermgr.sss.com/VGKey"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; targetNamespace="http://consumermgr.sss.com/VGKey"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:import namespace="http://consumermgr.sss.com/types"; schemaLocation="types.xsd"/>
	<xs:element name="VGKeyAttributeSet" type="vgk:VGKeyAttributeSet_Type" substitutionGroup="types:AbstractAttributeSet"/>
	<xs:complexType name="VGKeyAttributeSet_Type">
		<xs:complexContent>
			<xs:extension base="types:AbstractAttributeSet_Type">
				<xs:sequence>
					<xs:element ref="types:pin"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
</xs:schema>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:m0="http://consumermgr.nds.com/consumermgr"; xmlns:m1="http://consumermgr.nds.com/VGKey"; xmlns:m2="http://consumermgr.nds.com/types"; xmlns:m3="http://consumermgr.nds.com/STB";>
	<SOAP-ENV:Body>
		<m:addDevice xmlns:m="http://consumermgr.nds.com"; SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
			<addDeviceInputParam>
				<m0:deviceId>5</m0:deviceId>/>
				<m3:STBAttributeSet >
					<m2:password>helloworld</m2:password>/>
				</m3:STBAttributeSet>
			</addDeviceInputParam>
		</m:addDevice>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to