Skip to Content.
Sympa Menu

mace-opensaml-users - XACML Unmarshalling ClassCast XSAnyImpl Exceptions

Subject: OpenSAML user discussion

List archive

XACML Unmarshalling ClassCast XSAnyImpl Exceptions


Chronological Thread 
  • From: Anthony Whitehead <>
  • To:
  • Subject: XACML Unmarshalling ClassCast XSAnyImpl Exceptions
  • Date: Fri, 23 Apr 2010 17:45:20 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=fIpRfdFHhdDdoESlaMLPBTygf3qGdJ9XXNjGcFguJyPY/ZLnhV5ApHpPtbtzx3qQ1h 7ikbCyYfw8F8Iyq/fSuZ46QU1CKii9AyEfnDG1tOlRw8vwI60NK2vcpCAyM7C9chken3 AhTBIgKmt29xLiogCaaJ3DhmhnYPRcnzF/mfM=

Hi,

Just curious if I'm doing something horribly wrong to get the following class cast exceptions during unmashalling of any XACML XML. All other SAML Objects work fine.
Using Java 5, opensaml 2.3.1, xmltooling 1.2.1 and openws 1.3.0.

Here is the exception:

java.lang.ClassCastException: org.opensaml.xml.schema.impl.
XSAnyImpl
        at org.opensaml.xacml.profile.saml.impl.XACMLAuthzDecisionQueryTypeUnmarshaller.processAttribute(XACMLAuthzDecisionQueryTypeUnmarshaller.java:56)
        at org.opensaml.xml.io.AbstractXMLObjectUnmarshaller.unmarshallAttribute(AbstractXMLObjectUnmarshaller.java:236)
        at org.opensaml.xml.io.AbstractXMLObjectUnmarshaller.unmarshall(AbstractXMLObjectUnmarshaller.java:107)
        at testXACML.main(testXACML.java:53)

Here is the simple testing code:
public class testXACML {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String file = "example_xacml_query.xml";
    try {
            DefaultBootstrap.bootstrap();

        InputStream in = new FileInputStream(file);
        BasicParserPool pool = new BasicParserPool();
        Document doc = pool.parse( in );

        Unmarshaller queryUnmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(XACMLAuthzDecisionQueryType.DEFAULT_ELEMENT_NAME_XACML20);

        XACMLAuthzDecisionQueryType xacmlRequest = (XACMLAuthzDecisionQueryType)queryUnmarshaller.unmarshall( doc.getDocumentElement() ); // Line 53
        } catch( Exception e ) {
            e.printStackTrace();
        }
    } 
}

And here is the simple XACML data:
<?xml version="1.0" encoding="UTF-8"?><xacml-samlp:XACMLAuthzDecisionQuery xmlns:xacml-samlp="urn:oasis:xacml:2.0:saml:protocol:schema:os" Destination="https://eh.mysmartxs.com/getronicsap/SAMLResponder" ID="_4dc8f18dc1db53a8ea986c8213640e50" IssueInstant="2010-04-22T17:27:35.379Z" ReturnContext="true" Version="2.0" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"><saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">testissuer</saml:Issuer>
<xacml-context:Request xmlns:xacml-context="urn:oasis:names:tc:xacml:2.0:context:schema:os">
<xacml-context:Subject><xacml-context:Attribute AttributeId="userid" DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="testissuer"><xacml-context:AttributeValue>test</xacml-context:AttributeValue></xacml-context:Attribute></xacml-context:Subject>
<xacml-context:Resource><xacml-context:Attribute AttributeId="resourcename" DataType="http://www.w3.org/2001/XMLSchema#string"><xacml-context:AttributeValue>myresource</xacml-context:AttributeValue></xacml-context:Attribute></xacml-context:Resource>
<xacml-context:Action><xacml-context:Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string"><xacml-context:AttributeValue>Authenticate</xacml-context:AttributeValue></xacml-context:Attribute></xacml-context:Action>
<xacml-context:Environment/>
</xacml-context:Request>
</xacml-samlp:XACMLAuthzDecisionQuery>

So, what am I doing wrong?

Thanks,

/Ant



Archive powered by MHonArc 2.6.16.

Top of Page