Skip to Content.
Sympa Menu

mace-opensaml-users - Re: Reading a SAML Assertion from a file

Subject: OpenSAML user discussion

List archive

Re: Reading a SAML Assertion from a file


Chronological Thread 
  • From: "Cristian Opincaru" <>
  • To: "Scott Cantor" <>
  • Cc:
  • Subject: Re: Reading a SAML Assertion from a file
  • Date: Tue, 10 Oct 2006 17:58:57 +0200
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=AVy0q4Ft+sMaVb2Cam0ZhiVxY7L/dl8BX7ehCWoWMZwnvuCl0m5xNO23r53r12K+S3o1Xz9xnyCiegADi4aZF17Z8r1ggbMRd4SgZoO+NbwtWktvQxX+MW6S+Vj3GD6WzpzOBE9OK7FqQlisHX5UuFl5b+hz/bFjVv8NLfB8mNc=

Scott,

I'm executing the following code:

            SAMLAssertion licenseToken = new SAMLAssertion(new FileInputStream(LICENSE_TOKEN_FILE));           
            WSSAddSAMLToken addSaml = new WSSAddSAMLToken();
            envelope = addSaml.build(envelope, licenseToken);                       
           
            Canonicalizer c14n = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
            byte[] canonicalMessage = c14n.canonicalizeSubtree(envelope);

// ... at this point I'm constructing an Apache Axis Message object from the XML envelope ...

The exception trace is as follows:

java.lang.NullPointerException
    at org.apache.xml.security.c14n.implementations.CanonicalizerBase.outputTextToWriter(Unknown Source)
    at org.apache.xml.security.c14n.implementations.CanonicalizerBase.canonicalizeSubTree(Unknown Source)
    at org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree (Unknown Source)
    at org.apache.xml.security.c14n.implementations.Canonicalizer20010315Excl.engineCanonicalizeSubTree(Unknown Source)
    at org.apache.xml.security.c14n.implementations.Canonicalizer20010315Excl.engineCanonicalizeSubTree (Unknown Source)
    at org.apache.xml.security.c14n.Canonicalizer.canonicalizeSubtree(Unknown Source)
    at de.unibw.s3f.client.authentication.TestX509AndLicenseToken.main(TestX509AndLicenseToken.java:178)

Now, the strange thing is, that if I run the following code:

            SAMLAssertion licenseToken = new SAMLAssertion(new FileInputStream(LICENSE_TOKEN_FILE));           
            System.out.println(XMLUtils.DocumentToString (licenseToken.toDOM().getOwnerDocument()));
            WSSAddSAMLToken addSaml = new WSSAddSAMLToken();
            envelope = addSaml.build(envelope, licenseToken);                       
           
            Canonicalizer c14n = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
            byte[] canonicalMessage = c14n.canonicalizeSubtree(envelope);

(you can notice that I simply call XMLUtils.DocumentToString), everything works smooth & fine.

Thanks for looking into this!

Cheers,
Cristian

On 10/10/06, Scott Cantor <> wrote:
> As I also mentioned in the comment, without cloning the
> Document I get a NullPointerException when I try to send the message.
>
> Any clue on this strange thing?

XML libraries written by different people tend to basically not work
together, and WSS4J isn't my code.

If you have a stack trace I might be able to speculate, but what you posted
doesn't really suggest anything to me. Cloning a document isn't really very
common in any case, as opposed to just importing nodes.

I can usually spot issues related to document reuse or management because of
how my code works, but this doesn't jump out at me.

-- Scott




--
Cristian OPINCARU
University of the Federal Armed Forces Munich
http://www.unibw.de/cristian.opincaru


Archive powered by MHonArc 2.6.16.

Top of Page