Skip to Content.
Sympa Menu

mace-opensaml-users - Re: AttributeValue creation

Subject: OpenSAML user discussion

List archive

Re: AttributeValue creation


Chronological Thread 
  • From: Chad La Joie <>
  • To:
  • Subject: Re: AttributeValue creation
  • Date: Thu, 01 Feb 2007 07:51:24 -0500
  • Organization: OIS - Middleware

No, you don't have to use the default provider (and probably shouldn't) in order to create attribute values. Instead you'd get the builder for whatever you want to use as an attribute value and build it using the element name AttributeValue. So, for example, lets say you wanted to have a value that is a string. Get the builder for the XSString object (our XMLObject that models the XML schema string type). Then, instead of using the normal buildObject method use one of the ones that takes both the element name AND the schema type, for example buildObject(QName, QName), passing in the AttributeValue qname for the first argument and the XSString type for the second.

This way, when the object is marshalled you end up with something like

<saml2:AttributeValue xsi:type="xs:string">
Some attribute value
</saml2:AttributeValue/>

Note that the proxy element only gets used if the library is unable to determine what the element actually contains. By specifying the schema type (string) the library would appropriately unmarshall the above snippet into an XSString XMLObject. If the type wasn't there it would have no way of knowing the type of the element and would fall back to the proxy.

Subash Devkota wrote:
Hi all,

I am using the latest java-saml2 codes from svn.

I want to build AttributeValue object and append it to Attribute. There is no AttributeValueBuilder.

https://spaces.internet2.edu/display/SHIB/OSTwoUsrManJavaLibIntro page under *Default Object Provider* section states that:

In most cases developer's wont encounter this XMLObject. However, it's common that this object will be used as the container for AttributeValue elements.


Scott and Chad,
Does it mean, we need to use this default object provider for creating AttributeValue object?
I tried it in the following manner.
In common-config.xml file, I found the entry
<BuilderClass className="org.opensaml.xml.ElementProxyBuilder" />
and tried to create the object using the code:

org.opensaml.xml.ElementProxyBuilder proxyBuilder= new org.opensaml.xml.ElementProxyBuilder();
AttributeValue attributeValue= (AttributeValue) proxyBuilder.buildObject(SAMLConstants.SAML20_NS, AttributeValue.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
But, I encounter the ClassCastException in second line.

How can I create AttributeValue object?

Thanks in advance
Subash

PRIVACY NOTICE

This email and any attachments may be confidential and/or privileged. Use of the information contained in this email by anyone other than the intended recipient is strictly prohibited. If you have received this email in error, please notify the sender by replying to this message and delete this email.

--
Chad La Joie 2052-C Harris Bldg
OIS-Middleware 202.687.0124



Archive powered by MHonArc 2.6.16.

Top of Page