Skip to Content.
Sympa Menu

mace-opensaml-users - opensaml 2. Unmarshalling seems to not work

Subject: OpenSAML user discussion

List archive

opensaml 2. Unmarshalling seems to not work


Chronological Thread 
  • From: "sanchit misra" <>
  • To:
  • Subject: opensaml 2. Unmarshalling seems to not work
  • Date: Thu, 30 Aug 2007 18:36:27 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=kTGNcNC4HEyhivU45qOZj4GzXaGq9uNHv7WJl6khEpINTxy3YZ7TQOSRTvS/kzp43MVCLr64D1HSogkzWn/eGXLwt6RMHazAmEs+1RdZ0WM1GUUbLh3I0C60NDq6eDijXcMxBjNtLbgkqHmv4Gt8+kteyIQ2ymBD9Vf/mEFaq5A=

Hi I am using opensaml 2 in my project.
I followed the following steps:
1. created a new AuthzDecisionStatement
2. marshalled it and
3. used the output DOMElement * of marshall to create a new AuthzDecisionStatement using unmarshalling

and it works!!

But then I tried to use a file containing an AuthzDecisionStatement xml. I created a DOMDocument using that file and passed the DOMNode to the unmarshall

This is how my code looks like:
----------------------------------------------------------------------------------------------------------------------------------------------------
           // the below two lines are only to check whether the DOMNode element is correct
            XMLHelper::serialize(currentNode, cout);
            cout << endl;

            DOMElement *currentElement = dynamic_cast<DOMElement*>(currentNode);
            if(currentElement==NULL)
                cout << "unmarshall: currentElement = NULL\n";

            const XMLObjectBuilder* builder = XMLObjectBuilder::getBuilder( currentElement ) ;
            cout << "unmarshall: node = " << currentNode->getNodeName() << endl; 
            XMLObject* xo = builder->buildFromElement( currentElement ) ;

            AuthzDecisionStatement *statement = dynamic_cast<AuthzDecisionStatement*>(xo);
             
            if(statement==NULL)
                cout << "unmarshall: statement is NULL\n";
----------------------------------------------------------------------------------------------------------------------------------------------------

I am getting the following output:
<saml:AuthzDecisionStatement Decision="permit" Resource="resource" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"/>
unmarshall: node = saml:AuthzDecisionStatement
unmarshall: statement is NULL

which means currentElement is not NULL, but statement is. I also checked if xo is NULL, but it isn't which means its a case of dynamic_cast failing. Which means builder doesn't return a proper AuthzDecisionStatement.
I don't how to find which builder was invoked.
Also looking at the xml, I can't think of any reason of not working. I hope it's not because the xmlns:saml attribute is last instead of being first in the list.







Archive powered by MHonArc 2.6.16.

Top of Page