Re: Serialization of XML includes an abstract elemt and not one of the possible substitutions
I just want to let you know that I switched from ADB to xmlbeans (wdl2java -d xmlbeans...) that work correctly for this WSDL, so I'm going to stick to xmlbeans. http://www.nabble.com/file/p15728080/authz.wsdl authz.wsdl http://www.nabble.com/file/p15728080/info_gryb_xacml_config.xml info_gryb_xacml_config.xml Gaurav, I've just downloaded the nightly build as you suggested and updated my M2_REPO with new jars using 'mvn install:file-install ...', but have the same problem as Mads: substitutionGroup doesn't work correctly. I've attached WSDL with all schemas and input XML. I use the following code to deserialize Config object: XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader xmlReader = factory.createXMLStreamReader(rs); Config cf = new Config(); Config.Factory.parse(xmlReader); log.debug(Read config file successfully); if (cf.getPolicySet() != null) log.debug(Policy set description: + cf.getPolicySet().getDescription()); ret = cf; I got Unexpected subelement exception. Please look into code that wsdl2code has generated: ConditionType.Factory.parse: . if (reader.isStartElement() new javax.xml.namespace.QName(urn:oasis:names:tc:xacml:2.0:policy:schema:os,Expression).equals(reader.getName())){ object.setExpression(os.schema.policy._0._2.xacml.tc.names.oasis.ExpressionType.Factory.parse(reader)); reader.next(); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException(Unexpected subelement + reader.getLocalName()); } The problem with this code is that: new javax.xml.namespace.QName(urn:oasis:names:tc:xacml:2.0:policy:schema:os,Expression).equals(reader.getName()) will NEVER return true becuase Expression is an abstract element that will never be present in an input XML. That's why it throws the exception in spite of the fact that I pass an element that does belong to Expression substitution group. PS. It's actually about de-serialization code. Was it fixed as well? gaurav lall wrote: Hi Mads - Axis2 nightly build has changes in the way which serialization is done in axis2 ,it uses the xml bean serialization instead of axion, you might want to try generating the wsdl2code using the latest nightly build. Thanks Gaurav -- View this message in context: http://www.nabble.com/Serialization-of-XML-includes-an-abstract-elemt-and-not-one-of-the-possible-substitutions-tp14921340p15773050.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Serialization of XML includes an abstract elemt and not one of the possible substitutions
http://www.nabble.com/file/p15728080/authz.wsdl authz.wsdl http://www.nabble.com/file/p15728080/info_gryb_xacml_config.xml info_gryb_xacml_config.xml Gaurav, I've just downloaded the nightly build as you suggested and updated my M2_REPO with new jars using 'mvn install:file-install ...', but have the same problem as Mads: substitutionGroup doesn't work correctly. I've attached WSDL with all schemas and input XML. I use the following code to deserialize Config object: XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader xmlReader = factory.createXMLStreamReader(rs); Config cf = new Config(); Config.Factory.parse(xmlReader); log.debug(Read config file successfully); if (cf.getPolicySet() != null) log.debug(Policy set description: + cf.getPolicySet().getDescription()); ret = cf; I got Unexpected subelement exception. Please look into code that wsdl2code has generated: ConditionType.Factory.parse: . if (reader.isStartElement() new javax.xml.namespace.QName(urn:oasis:names:tc:xacml:2.0:policy:schema:os,Expression).equals(reader.getName())){ object.setExpression(os.schema.policy._0._2.xacml.tc.names.oasis.ExpressionType.Factory.parse(reader)); reader.next(); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException(Unexpected subelement + reader.getLocalName()); } The problem with this code is that: new javax.xml.namespace.QName(urn:oasis:names:tc:xacml:2.0:policy:schema:os,Expression).equals(reader.getName()) will NEVER return true becuase Expression is an abstract element that will never be present in an input XML. That's why it throws the exception in spite of the fact that I pass an element that does belong to Expression substitution group. PS. It's actually about de-serialization code. Was it fixed as well? Hi Mads - Axis2 nightly build has changes in the way which serialization is done in axis2 ,it uses the xml bean serialization instead of axion, you might want to try generating the wsdl2code using the latest nightly build. Thanks Gaurav -- View this message in context: http://www.nabble.com/Serialization-of-XML-includes-an-abstract-elemt-and-not-one-of-the-possible-substitutions-tp14921340p15728080.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Serialization of XML includes an abstract elemt and not one of the possible substitutions
Hi There, I'm having a problem, that I need your help on. Using Axis2 1.3 I have generated java classes from a WSDL file. The data binding framework used is XMLBeans (the structure of the wsdl and xsd files is very complex, so we decided on XMLBeans instead of ADB, hoping that would result in more correct generated code). The Web Service server is the Exchange Web Service interface that is a part of Microsoft Exchange 2007, so we have no way of changing the server side. We have downloaded the WSDL from the Exchange server (and added a service tag, as this was not included). The WSDL refers to two xsd files, one that defines Message stuff (error codes as ENUM and different basic stuff) and one that defines the different types and elements. Here is a small abstract of the XML Schema is appended: === START OF SCHEMA === xs:schema id=types elementFormDefault=qualified version=Exchange2007_SP1 xmlns:t=http://schemas.microsoft.com/exchange/services/2006/types; targetNamespace=http://schemas.microsoft.com/exchange/services/2006/types; xmlns:tns=http://schemas.microsoft.com/exchange/services/2006/types; xmlns:xs=http://www.w3.org/2001/XMLSchema; xs:element name=Path abstract=true type=t:BasePathToElementType/ xs:element name=FieldURI type=t:PathToUnindexedFieldType substitutionGroup=t:Path/ xs:element name=IndexedFieldURI type=t:PathToIndexedFieldType substitutionGroup=t:Path / xs:element name=ExtendedFieldURI type=t:PathToExtendedFieldType substitutionGroup=t:Path/ xs:complexType name=TwoOperandExpressionType abstract=true xs:complexContent xs:extension base=t:SearchExpressionType xs:sequence xs:element ref=t:Path/ xs:element name=FieldURIOrConstant type=t:FieldURIOrConstantType/ /xs:sequence /xs:extension /xs:complexContent /xs:complexType xs:complexType name=FieldURIOrConstantType xs:choice xs:element ref=t:Path/ xs:element name=Constant type=t:ConstantValueType / /xs:choice /xs:complexType xs:complexType name=ConstantValueType xs:attribute name=Value type=xs:string use=required / /xs:complexType xs:complexType name=IsEqualToType xs:complexContent xs:extension base=t:TwoOperandExpressionType/ /xs:complexContent /xs:complexType xs:element name=IsEqualTo type=t:IsEqualToType substitutionGroup =t:SearchExpression/ === END OF SCHEMA === As I understand this schema. When I create a IsEqualTo element, I should be able to add either FieldURI, IndexedFieldURI, or ExtendedFieldURI element. However the generated code has a method called setPath(BasePathToElementType), and regardless what I do the request being sent to the server contains a Path element instead of one of the possible substitutes. The following classes are created: PathDocument FieldURIDocument IndexedFieldURIDocument ExtendedFieldURIDocument I would expect the PathDocument to be an abstract class which each of the three substitution types extends; but the PathDocument class is in fact not abstract, and objects can be created. If I call the method xmlText() on each of the three classes: FieldURIDocument, IndexedFieldURIDocument, and ExtendedFieldURIDocument, correct XML is returned (e.g. FieldURI FieldURI=item:ItemClass xmlns=http://schemas.microsoft.com/exchange/services/2006/types/). The ultimate goal is to produce this XML: typ:IsEqualTo xmlns:typ=http://schemas.microsoft.com/exchange/services/2006/types; FieldURI FieldURI=item:ItemClass xmlns=http://schemas.microsoft.com/exchange/services/2006/types; / typ:FieldURIOrConstant typ:Constant Value=IPM.Note / /typ:FieldURIOrConstant /typ:IsEqualTo But what the axis generated classes produce is this (see the path element): typ:IsEqualTo xmlns:typ=http://schemas.microsoft.com/exchange/services/2006/types; typ:Path FieldURI=item:ItemClass xsi:type=typ:PathToUnindexedFieldType xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; / typ:FieldURIOrConstant typ:Constant Value=IPM.Note / /typ:FieldURIOrConstant /typ:IsEqualTo Anyone out there who can point/push me in the right direction? Any help is greatly appreciated. Or is this simply related to a bug in the code generation? For now, we have extended the generated code with methods for adding each of the three type, but in the long run, that's not a suitable solution. Regards Mads
Re: Serialization of XML includes an abstract elemt and not one of the possible substitutions
Hi Mads - Axis2 nightly build has changes in the way which serialization is done in axis2 ,it uses the xml bean serialization instead of axion, you might want to try generating the wsdl2code using the latest nightly build. Thanks Gaurav On Jan 17, 2008 7:09 AM, Mads Falkenberg Brenøe [EMAIL PROTECTED] wrote: Hi There, I'm having a problem, that I need your help on. Using Axis2 1.3 I have generated java classes from a WSDL file. The data binding framework used is XMLBeans (the structure of the wsdl and xsd files is very complex, so we decided on XMLBeans instead of ADB, hoping that would result in more correct generated code). The Web Service server is the Exchange Web Service interface that is a part of Microsoft Exchange 2007, so we have no way of changing the server side. We have downloaded the WSDL from the Exchange server (and added a service tag, as this was not included). The WSDL refers to two xsd files, one that defines Message stuff (error codes as ENUM and different basic stuff) and one that defines the different types and elements. Here is a small abstract of the XML Schema is appended: === START OF SCHEMA === xs:schema id=types elementFormDefault=qualified version=Exchange2007_SP1 xmlns:t= http://schemas.microsoft.com/exchange/services/2006/types; targetNamespace= http://schemas.microsoft.com/exchange/services/2006/types; xmlns:tns= http://schemas.microsoft.com/exchange/services/2006/types; xmlns:xs=http://www.w3.org/2001/XMLSchema; xs:element name=Path abstract=true type=t:BasePathToElementType/ xs:element name=FieldURI type=t:PathToUnindexedFieldType substitutionGroup=t:Path/ xs:element name=IndexedFieldURI type=t:PathToIndexedFieldType substitutionGroup=t:Path / xs:element name=ExtendedFieldURI type=t:PathToExtendedFieldType substitutionGroup=t:Path/ xs:complexType name=TwoOperandExpressionType abstract=true xs:complexContent xs:extension base=t:SearchExpressionType xs:sequence xs:element ref=t:Path/ xs:element name=FieldURIOrConstant type=t:FieldURIOrConstantType/ /xs:sequence /xs:extension /xs:complexContent /xs:complexType xs:complexType name=FieldURIOrConstantType xs:choice xs:element ref=t:Path/ xs:element name=Constant type=t:ConstantValueType / /xs:choice /xs:complexType xs:complexType name=ConstantValueType xs:attribute name=Value type=xs:string use=required / /xs:complexType xs:complexType name=IsEqualToType xs:complexContent xs:extension base=t:TwoOperandExpressionType/ /xs:complexContent /xs:complexType xs:element name=IsEqualTo type=t:IsEqualToType substitutionGroup =t:SearchExpression/ === END OF SCHEMA === As I understand this schema. When I create a IsEqualTo element, I should be able to add either FieldURI, IndexedFieldURI, or ExtendedFieldURI element. However the generated code has a method called setPath(BasePathToElementType), and regardless what I do the request being sent to the server contains a Path element instead of one of the possible substitutes. The following classes are created: PathDocument FieldURIDocument IndexedFieldURIDocument ExtendedFieldURIDocument I would expect the PathDocument to be an abstract class which each of the three substitution types extends; but the PathDocument class is in fact not abstract, and objects can be created. If I call the method xmlText() on each of the three classes: FieldURIDocument, IndexedFieldURIDocument, and ExtendedFieldURIDocument, correct XML is returned (e.g. FieldURI FieldURI=item:ItemClass xmlns= http://schemas.microsoft.com/exchange/services/2006/types/). The ultimate goal is to produce this XML: typ:IsEqualTo xmlns:typ= http://schemas.microsoft.com/exchange/services/2006/types; FieldURI FieldURI=item:ItemClass xmlns= http://schemas.microsoft.com/exchange/services/2006/types; / typ:FieldURIOrConstant typ:Constant Value=IPM.Note / /typ:FieldURIOrConstant /typ:IsEqualTo But what the axis generated classes produce is this (see the path element): typ:IsEqualTo xmlns:typ= http://schemas.microsoft.com/exchange/services/2006/types; typ:Path FieldURI=item:ItemClass xsi:type=typ:PathToUnindexedFieldTypexmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; / typ:FieldURIOrConstant typ:Constant Value=IPM.Note / /typ:FieldURIOrConstant /typ:IsEqualTo Anyone out there who can point/push me in the right direction? Any help is greatly appreciated. Or is this simply related to a bug in the code generation? For now, we have extended the generated code with methods for adding each of the three type, but in the long run, that's not a suitable solution. Regards Mads