Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] Marshaling an Extension

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] Marshaling an Extension


Chronological Thread 
  • From: Brent Putman <>
  • To:
  • Subject: Re: [OpenSAML] Marshaling an Extension
  • Date: Thu, 19 May 2011 18:54:36 -0400



On 5/19/11 7:52 AM, rangeli nepal wrote:
> Good Morning Everybody,
>
> Extensions extensions =
> extBuilder.buildObject(SAMLConstants.SAML20_NS, Extensions.LOCAL_NAME,
> SAMLConstants.SAML20_PREFIX);
>
> It builds the object but when marshaling it it gives:
>
> java.lang.ClassCastException:
> org.opensaml.saml2.common.impl.ExtensionsImpl cannot be cast to
> org.opensaml.xml.schema.XSAny
>


Yeah, your problem above is just a typo, the Extensions element is in
the protocols namespace, not the assertion namespace, so you are missing
the "P" in the constant names above, e.g. SAML20P_NS.

It's failing to find a provider with the requested non-existant QName,
so it's returning to you the default XSAny impl, and naturally you can't
cast that to an Extensions object.


This works correctly, for example.


QName name = new QName(SAMLConstants.SAML20P_NS, Extensions.LOCAL_NAME,
SAMLConstants.SAML20P_PREFIX);
Extensions ext = (Extensions)
Configuration.getBuilderFactory().getBuilder(name).buildObject(name);




Archive powered by MHonArc 2.6.16.

Top of Page