Skip to Content.
Sympa Menu

mace-opensaml-users - local part cannot be "null" when creating a QName during unmarshalling an Assertion object

Subject: OpenSAML user discussion

List archive

local part cannot be "null" when creating a QName during unmarshalling an Assertion object


Chronological Thread 
  • From: Sidhartha Priye <>
  • To:
  • Cc: Sidhartha Priye <>
  • Subject: local part cannot be "null" when creating a QName during unmarshalling an Assertion object
  • Date: Fri, 26 Feb 2010 17:31:06 -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:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=okt/F6exdzPAlqFc8ixJ4pEt8f+bRW15RQbOZvR+SDDxJJQVzAqPmF68jttlT8ATJnau3AJpf2RmPbReW/4EY+dX95xytAhwEJpc49epWUEDkv82kPtPjqxxFGoC9Hgd1MK6W/o+iUgaAXUDD3NEw0dKmGHOidC6zIL/Qw7dbQU=;

Hello everyone!!!

I am injecting a SAML Assertion in a SOAP Header from the SOAPClient and then issuing a service request to a Apache CXF webservice. On the webservice end I have a JAX-WS SOAP Handler that intercepts and unmarshals the header.

However when I am trying to unmarshall the Assertion Element, I am getting this following exception stacktrace:


[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)
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
org.opensaml.xml.io.AbstractXMLObjectUnmarshaller.unmarshall(AbstractXMLObjectUnmarshaller.java:107)
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
com.syscom.hsc.web.soap.ServiceSAMLHandler.handleMessage(ServiceSAMLHandler.java:222)
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
com.syscom.hsc.web.soap.ServiceSAMLHandler.handleMessage(ServiceSAMLHandler.java:1)
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeHandleMessage(HandlerChainInvoker.java:335)
[2/26/10 17:16:11:612 EST] 0000001c SystemErr    R      at
****************************************************************************************************************
This is the line of code where the exception is being thrown on the JAX WS Service Handler
***************************************************************************************************************
<code>
            UnmarshallerFactory unmarshallerFactory = Configuration
                  .getUnmarshallerFactory();

            Unmarshaller unmarshaller = unmarshallerFactory
                  .getUnmarshaller(assertionElement);
          
            Assertion samlAssertion =
                (Assertion) unmarshaller.unmarshall(assertionElement);
</code>

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();

</code>

****************************************************************************************************************
On the client side SAML Handler, I have tried both these approaches
for creating the Assertion object
****************************************************************************************************************
<code>
                    DefaultBootstrap.bootstrap();
                  
                    SOAPMessage message = smc.getMessage();
                    SOAPPart soapPart = message.getSOAPPart();
                    SOAPEnvelope soapEnvelope =
soapPart.getEnvelope();
                    Name wsseHeaderName =
soapEnvelope.createName("Security",
                          "wsse", WS_SECURITY_NS_URI);
                    if (soapEnvelope.getHeader() == null) {
                      soapEnvelope.addHeader();
                    }
                    SOAPHeaderElement securityElement =
soapEnvelope.getHeader()
                          .addHeaderElement(wsseHeaderName);

                    //    APPROACH 1: Get the builder factory
                    SAMLObjectBuilder<Assertion> ab =
(SAMLObjectBuilder<Assertion>)
                                                          
builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);

                    // APPROACH 2: Get the builder factory
                    //  AssertionBuilder ab =
(AssertionBuilder)builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
                    Assertion assertion = ab.buildObject();
..............
............
.............

                        try {
                                        assertionElement =
                                              
Configuration.getMarshallerFactory().getMarshaller(assertion).marshall(assertion);
                                } catch (MarshallingException e) {
                                    e.printStackTrace();
                                }
</code>
*****************************************************************************************************************

I have hit a dead end on this critical path of implementing a Spring/SAML/CXF SSO protoype effort currently for a client.
Any help would be greatly appreciated.






  • local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 02/26/2010

Archive powered by MHonArc 2.6.16.

Top of Page