[OpenSAML] Two SAML objects sharing an element name?

12 views
Skip to first unread message

Jared Camarata

unread,
Mar 23, 2011, 1:23:55 PM3/23/11
to mace-open...@internet2.edu
Hi all,

I am new to opensaml but basically I am building and decoding xml documents for file requests. I have a samlobject called FileRequest which gets marshaled to <FileRequest ID="xx">. There are indeed children elements. I now have a need to have a different type of FileRequest that will have different child elements. Would I be able to extend the FileRequest interface to make QuickFileRequest that inherits the DEFAULT_ELEMENT_NAME from FileRequest? The reason being is that it needs to share the element name, but QuickFileRequest will have different methods in the impl and different children elements.

I have tried this, and I am using XML Tooling to create my QuickFileRequest. My line of code is QuickFileRequest qfr = QuickFileRequestBuilder.buildObject();... Unfortunately the buildObject is returning a FileRequest class object and it wont cast into the QuickFileRequest. Is it creating a FileRequest because of the default_element_name?

Thank you very much,
Jared C

Chad La Joie

unread,
Mar 23, 2011, 1:27:50 PM3/23/11
to mace-open...@internet2.edu
Do you have a valid XML schema that describes what you're trying to do?

--
Chad La Joie
www.itumi.biz
trusted identities, delivered

jared camarata

unread,
Mar 23, 2011, 1:49:03 PM3/23/11
to mace-open...@internet2.edu, Chad La Joie
No I'm sorry I don't at this time.

Chad La Joie

unread,
Mar 23, 2011, 1:52:36 PM3/23/11
to mace-open...@internet2.edu
OpenSAML differentiates elements based on element name and element
type. So, if the element name is going to be the same you'll have to
do it by schema type.

--

jared camarata

unread,
Mar 23, 2011, 2:03:42 PM3/23/11
to mace-open...@internet2.edu
So on my QuickFileRequest interface I need to override TYPE_LOCAL_NAME and set it to QuickFileRequest?

Thank you,
Jared

Chad La Joie

unread,
Mar 23, 2011, 2:05:40 PM3/23/11
to mace-open...@internet2.edu
Like I said, you either need to differentiate the elements by name or type.

jared camarata

unread,
Mar 23, 2011, 2:23:57 PM3/23/11
to mace-open...@internet2.edu, Chad La Joie
I'm still a bit confused though, my apologies. Since I need the element name to be the same, I'm going to differentiate the type local name. However, my impl extends  AbstractValidatingSignableXMLObject from opensaml. The constructor for this class is  protected AbstractValidatingSignableXMLObject(String namespaceURI, String elementLocalName, String namespacePrefix). It seems to ask for the element name only. Where does the type name come into play?

Thanks,
Jared

Cantor, Scott E.

unread,
Mar 23, 2011, 4:37:22 PM3/23/11
to mace-open...@internet2.edu
You need to start with a schema.

OpenSAML is not meant as a generic XML processing tool, but if you're
going to use it for that, you have to start with a schema, and then map
that schema to the classes you have to build. If you want to use comment
element names, that means you're using polymorophic types via xsi:type,
and you need to understand that mechanism before you even consider writing
code.

-- Scott

jared camarata

unread,
Mar 23, 2011, 4:45:37 PM3/23/11
to mace-open...@internet2.edu, Cantor, Scott E.
Perfect, Thank you for the direction Scott and Chad.

Jared
Reply all
Reply to author
Forward
0 new messages