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 09:39:13 -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=RsK+bTUVSFEkGkNmN5hUoWAK+Z0dZjgTUIHez4nmRccXawoeNp8ygvHJsCF8jLPnSM4Bms2Ja1w2D3fihNk4gaENnDsDm6jDDQWOCByWSFxSCxherXTrbd6HNpAZ6abQienENNUcDfuSKRPpehiuXpUTGb2olZokupmZtHVOLow=;

Scott, Brent

Essentially here is the code that I have when I am unmarshalling the
Assertion Element in the SOAP Header

DefaultBootstrap.bootstrap();
SOAPHeader sh = smc.getMessage().getSOAPHeader();

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

if (wsseElement == null ||
!"Security".equals(wsseElement.getLocalName())
|| !WS_SECURITY_URI.equals(wsseElement.getNamespaceURI())) {
throw createSOAPFaultException("Missing or invalid WS-Security
Header",
true);
}

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

if (assertionElement == null
|| !"Assertion".equals(assertionElement.getLocalName())
||
!SAMLConstants.SAML20_NS.equals(assertionElement.getNamespaceURI())) {
throw createSOAPFaultException("Missing or invalid SAML
Assertion", true);
}

Assertion samlAssertion =
(Assertion) unmarshall(assertionElement);

................................

protected static XMObject unmarshall(Element samlElem) {
UnmarshallerFactory unmarshallerfactory =
Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller =
unmarshallerfactory.getUnmarshaller(samlElem);

try {
XMLObject xmlObject = unmarshaller.unmarshall(samlElem);
out.println("SAML document root element unmarshalled");
return xmlObject;
} catch (UnmarshallingException e) {
out.println("Unable to unmarshall XML DOM"+e);
}
return null;
}

Trace inside the AbstractXMLObjectUnmarshaller.unmarshallAttribute prints
this "DatatypeHelper.safeTrimOrNullString(attribute.getNamespaceURI())" to be
null. How can I make my code namespace aware, esp when I am parsing from a
SOAP Header.

thanks
Sid



----- Original Message ----
> From: Sidhartha Priye
> <>
> To:
>
> Sent: Mon, March 1, 2010 10:57:29 AM
> Subject: Re: [OpenSAML] local part cannot be "null" when creating a QName
> during unmarshalling an Assertion object
>
> I think yahoo mail Rich text was the culprit. sending via plain text.
> Hopefully
> it will go this time
>
>
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";>
> xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
> ID="_33776a319493ad607b7ab3e689482e45"
> IssueInstant="2010-03-01T05:30:49.730Z"
> Version="2.0">http://localhost:9088
> Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName">mbrendish
>
>
> thanks
> Sid
>
>
> >
> >From: Sidhartha Priye
> >To:
> >
> >Sent: Mon, March 1, 2010 10:02:23 AM
> >Subject: Re: [OpenSAML] local part cannot be "null" when creating a QName
> during unmarshalling an Assertion object
> >
> >
> >Not sure why my Assertion XML is getting stripped.
> >
> >Brent - How can I provide the XML. I am taking another shot
> >
> >
> >
> >
> >>http://localhost:9088 mbrendish
> GETFULLEOPINWRK'>http://web.hsc.syscom.com/";>GETFULLEOPINWRK
> -1'>http://web.hsc.syscom.com/";>-1
> >
> >
> >
> >
> >thanks
> >Sid
> >
> >
> ________________________________
> From: Sidhartha Priye
> >To:
> >
> >Sent: Mon, March 1, 2010 9:55:28 AM
> >Subject: Re: [OpenSAML] local part cannot be "null" when creating a QName
> during unmarshalling an Assertion object
> >
> >
> >Here is the Assertion Element that was stripped off from my previous post
> >
> >http://localhost:9088 mbrendish
> >
> >
> >thanks
> >Sid
> >
> >
> ________________________________
> From: Sidhartha Priye
> >To:
> >
> >Sent: Mon, March 1, 2010 9:48:59 AM
> >Subject: Re: [OpenSAML] local part cannot be "null" when creating a QName
> during unmarshalling an Assertion
> > object
> >
> >
> >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:9088 mbrendish
> >
> >
> >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.(Unknown Source)
> >>>>[2/26/10 17:16:11:612 EST] 0000001c SystemErr R at
> >>>>javax.xml.namespace.QName.(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
> >>>>
> >>>> 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