Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] unable to add ResourceContent (XML any type) to Resource attribute with opensaml.

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] unable to add ResourceContent (XML any type) to Resource attribute with opensaml.


Chronological Thread 
  • From: "Håkon Sagehaug" <>
  • To:
  • Subject: Re: [OpenSAML] unable to add ResourceContent (XML any type) to Resource attribute with opensaml.
  • Date: Tue, 30 Sep 2008 15:14:48 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version :content-type:references:x-google-sender-auth; b=W8xaN5JOyPRla4YfFZmrNXqN8e6QiO090Tejt90b9wIMFD6s/pSmReHETRG1fpQnIX th3cqYLLOjCua7wsvrkpWC//FfGWAHkz1YwiIP83BENO79HgjHh8kmsB1xM4yWK9LF8K 8M7+Fx6vv5/3Cz0y2+tb+G5oW2vqRa+N2LD/I=

Hi

Normally as i remember if you want something form DOM to java object in opensaml you use the unmarshaller for that object you want.. So for ResourceContent it would be the ResourceContentUnmarshaller.

Also  content.getContent() methog I cant see ResourceContentType in opensaml. what library are you using.

How is the xacml request generated?
2008/9/30 Michael Lausch <>
I'm trying to use OpenSAML and XACML (jboss implementation, derived
from SunXACML).
I want to put some existing DOM elements into the ResourceContent
attribute of my
XACML request, but i'm unablöe to do so.
I tried to add DOM Element objects, and strings, but they were ignored
during marshalling.

Any hints?

Code snippet, which mights be all wrong:

              ResourceType resourceType = new ResourceType();


              ResourceContentType content = new ResourceContentType();

              DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();

              try {

                      DocumentBuilder builder = factory.newDocumentBuilder();
                      Document document = builder.newDocument();

                      Element root = (Element)
document.createElementNS("rc","rootElement");

root.setAttribute("xmlns:rc","http://www.somecompany.com/2005/xyz");

                      document.appendChild(root);
                      Element child =
(Element)document.createElement("rc:child");
                      root.appendChild(child);


                      child.appendChild(document.createTextNode("Some"));
                      child.appendChild(document.createTextNode(" "));
                      child.appendChild(document.createTextNode("text"));

                      content.getContent().add(root);
                      QName attrname = new
QName("http://www.somecompany.com/2005/xyz",
"aaa", "rc");
                      content.getOtherAttributes().put(attrname, "value");
              } catch (ParserConfigurationException pce) {
                      // Parser with specified options can't be built
                      pce.printStackTrace();
              }


              resourceType.setResourceContent(content);



--
Håkon Sagehaug, Software Developer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)



Archive powered by MHonArc 2.6.16.

Top of Page