Skip to Content.
Sympa Menu

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

Subject: OpenSAML user discussion

List archive

Re: opensaml 2. Unmarshalling seems to not work


Chronological Thread 
  • From: "sanchit misra" <>
  • To:
  • Subject: Re: opensaml 2. Unmarshalling seems to not work
  • Date: Thu, 30 Aug 2007 20:37:31 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=fbCplTVbEoBoom68TB2iGg3azOc5LVAKAcWwrtQ5pSpQX+Wgp6UIXMlunewBVUepbw3WnM58EIFsZAXKDBS1JzxE37QHalgyFnZaazl3Q53j6dH/YdZXUFepD5Jydaco7iRng/kAcOnfynLbkiqX2Gv1185vYDViebMa5YkkD0w=

Sorry for my previous email. It seems there was a problem with the way I was generating my DOMDocument. Now I am using XMLTooling for that and its working :-).


Sanchit

On 8/30/07, sanchit misra <> wrote:
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