Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object


Chronological Thread 
  • From: Sidhartha Priye <>
  • To:
  • Subject: Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object
  • Date: Mon, 1 Mar 2010 06:48:59 -0800 (PST)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=qWksPpeLwlnxfs6RYyL9jWSiQCsdJR5OD8leJoNZdN0iG7z+9khCvorGsCosoq5+LIr5kB2OgW1+Hab6nc01wZaJsOv1qDGZUX0qkzWMCipNxaiIyshpxKBbH1e491LikkVrXgem8uwr7qwXGDSbwEp4eM9hJWe6jXhywyrv0Do=;

Thanks a bunch Brent,

Here is the XML of the SOAP Header that I am generating.  I am trying to test with a very basic Assertion element.

http://localhost:9088mbrendish


That being said, I have access to the AssertionElement.

UnmarshallerFactory unmarshallerfactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerfactory.getUnmarshaller(samlElem);
     
out.println("Unmarshalling SAML document root element{}"+XMLHelper.getNodeQName(samlElem));

The output is:

[3/1/10 3:02:16:725 EST] 0000001c SystemOut    O  Unmarshalling SAML document root element {}{urn:oasis:names:tc:SAML:2.0:assertion}Assertion

However It fails here
          XMLObject xmlObject = unmarshaller.unmarshall(samlElem);

When it was not obvious, I decompiled the AbstractXMLObjectUnmarshaller, added my own trace.
           
System.out.println("Node name"+attribute.getNodeName());      
System.out.println("Node value"+attribute.getNodeValue());          
System.out.println("Node type"+attribute.getNodeType());
if(attribute.getNodeType() == 2)
                unmarshallAttribute(xmlObject, Attr)attribute);
        }

The output is -
[3/1/10 3:02:16:741 EST] 0000001c SystemOut    O  Node name ID
[3/1/10 3:02:16:741 EST] 0000001c SystemOut    O  Node
value_33776a319493ad607b7ab3e689482e45
[3/1/10 3:02:16:741 EST] 0000001c SystemOut    O  Node type 2

thanks
Sid

________________________________


From: Brent Putman <>
To:
Sent: Mon, March 1, 2010 5:18:20 AM
Subject: Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object



On 2/26/2010 8:31 PM, Sidhartha Priye wrote:



[2/26/10 17:16:11:596 EST] 0000001c SystemErr    R  java.lang.IllegalArgumentException: local part cannot be "null" when
creating a QName
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
javax.xml.namespace.QName.<init>(Unknown Source)
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
javax.xml.namespace.QName.<init>(Unknown Source)
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
org.opensaml.xml.util.XMLHelper.constructQName(XMLHelper.java:433)
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
org.opensaml.xml.util.XMLHelper.getNodeQName(XMLHelper.java:171)
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
org.opensaml.xml.io.AbstractXMLObjectUnmarshaller.unmarshallAttribute(AbstractXMLObjectUnmarshaller.java:215)



It's failing trying to construct a QName out of an DOM Attr Node.    Either the XML you're sending is malformed in some way, or possibly the way that you parsed the structure into a DOM Element is causing a problem, perhaps it's not namespace-aware or something.  I'd confirm exactly what you are sending from the client by getting a trace of the message, just to be sure.




This is how I am getting the AssertionElement
<code>
      SOAPHeader sh = smc.getMessage().getSOAPHeader();

            // check for wsse:security element under SOAP Header
            Node wsseElement = sh.getFirstChild();

          // check for SAML assertion under wsse:security
element
            Element assertionElement = (Element)
wsseElement.getFirstChild();


Personally, I wouldn't necessarily assume that the first Node under the Security header is your Assertion.  You probably want to specifically check.  Your client might be generating something else in there automatically, like a WSS timestamp or something.  For that matter, it might not even be an Element Node at all, you could have whitespace Text node, etc.  OpenSAML has some helper methods there that you might want to use if you don't want to write your own code for that, like XMLHelper.getChildElementsByTagNameNS(Element root, String namespaceURI, String localName).

--Brent






Archive powered by MHonArc 2.6.16.

Top of Page