Hi everyone! I'm currently working on the implementation of an SCA component, exposed and called via SOAP, and I'm trying to dynamically load an XML file that contains an instance of an XSD type. I have generated the Java classes associated with this XSD and when I send SOAP request to Tuscany using such types as parameters, I get the static types associated with the data.
Here is my XML file: <?xml version="1.0" encoding="utf-8"?> <data:compte xmlns:data="http://localhost/testns" xsi:type="data:Compte" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <data:intitule>Test</data:intitule> <data:numero>1</data:numero> </data:compte> I'm using the following code: FileInputStream fis = new FileInputStream("/Development/default_data/file.xml"); XMLStreamHelperImpl strHelper = new XMLStreamHelperImpl(org.apache.tuscany.sca.databinding.sdo.SDOContextHelper.getDefaultHelperContext()); XMLDocument doc = XMLHelper.INSTANCE.load(fis); XMLStreamReader reader = strHelper.createXMLStreamReader(doc); reader.next(); DataObject obj = strHelper.loadObject(reader); If I execute it I get the following ClassCastException : The feature 'compte's type 'DataObject' does not permit a value of type 'Compte' I tried to load my XSD using XSDHelper: FileInputStream xsdfis = new FileInputStream("/Development/default_data/Schemas.xsd"); XSDHelper.INSTANCE.define(xsdfis, null); The exception is not raised anymore but I get a DynamicDataObject and not a static one. If I correctly understand the way Tuscany SDO works, the first exception is raised because the TypeHelper of the default context is "empty" (it only contains default types). When I call the XSDHelper.define method, my schemas are loaded but no link is done with my generated classes. How can I solve it ? What is the best way to get the same context as Tuscany ? I thought that I could use org.apache.tuscany.sca.databinding.sdo.SDOContextHelper.getHelperContext(Operation op) but I cannot figure out how to find the current operation. Best, Jawad
