Re: Serialization of XML includes an abstract elemt and not one of the possible substitutions

2008-02-29 Thread ogryb

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

2008-02-27 Thread ogryb

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]