Skip to Content.
Sympa Menu

mace-opensaml-users - Re: Error while creating AssertionIDRequestBuilder

Subject: OpenSAML user discussion

List archive

Re: Error while creating AssertionIDRequestBuilder


Chronological Thread 
  • From: Chad La Joie <>
  • To:
  • Subject: Re: Error while creating AssertionIDRequestBuilder
  • Date: Fri, 02 Jun 2006 08:32:31 -0400

Well there is something to be said for making the same typo consistently I suppose... It's fixed, I tested you code and it works. You should be good to go.

Sumit Shah wrote:
Hi Chad,


I got the latest code and tried it. But I get the following error:


16:24:55,187 ERROR [AbstractXMLObjectMarshaller] This marshaller only operations on {urn:oasis:names:tc:SAML:2.0:protocol}AssertionIDRequest elements not {urn:oasis:names:tc:SAML:2.0:assertion}AssertionIDRequest

org.opensaml.xml.io.MarshallingException: This marshaller only operations on {urn:oasis:names:tc:SAML:2.0:protocol}AssertionIDRequest elements not {urn:oasis:names:tc:SAML:2.0:assertion}AssertionIDRequest

at org.opensaml.xml.io.AbstractXMLObjectMarshaller.checkXMLObjectIsTarget(AbstractXMLObjectMarshaller.java:322)

at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:124)

at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:104)

at com.gce2000.saml.client.SAMLClient.marshall(SAMLClient.java:244)

at com.gce2000.saml.client.SAMLClient.init(SAMLClient.java:137)

at com.gce2000.saml.client.SAMLClient.<init>(SAMLClient.java:98)

at com.gce2000.saml.client.SAMLClient.main(SAMLClient.java:327)



Here is the code snippet:


//Build a new AssertionIDRequest

AssertionIDRequest req = buildRequest();


AssertionIDRequestMarshaller assertionIDRequestMarshaller = null;

MarshallerFactory marshallerFactory = Configuration.getMarshallerFactory();

assertionIDRequestMarshaller = (AssertionIDRequestMarshaller) marshallerFactory.getMarshaller(AssertionIDRequest.DEFAULT_ELEMENT_NAME);

try {


//I get the error here

Element requestElement1 = assertionIDRequestMarshaller.marshall(req);

System.out.println(requestElement1);

} catch (MarshallingException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}


Upon debugging, I see that the request gets built with :oasis:names:tc:SAML:2.0:assertion}AssertionIDRequest and hence its not able to marshall it.


Here is the code to build the request with dummy values:


XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();

Map builders = builderFactory.getBuilders();

AssertionIDRequestBuilder builder = null;

builder = (AssertionIDRequestBuilder) builderFactory.getBuilder(AssertionIDRequest.DEFAULT_ELEMENT_NAME);

AssertionIDRequest assertionIDRequest = builder.buildObject();

//System.out.println(assertionIDRequest.getElementQName());


Issuer issuer = new IssuerBuilder().buildObject();;

issuer.setNameQualifier("DUMMY");

assertionIDRequest.setDestination("SOME URL");

assertionIDRequest.setID("1212121211");

assertionIDRequest.setVersion(SAMLVersion.VERSION_20);

return assertionIDRequest;



I would appreciate your help on this.


Thanks

Sumit




-----Original Message-----

From: Sumit Shah

Sent: Thursday, June 01, 2006 10:30 AM

To: Chad La Joie;


Subject: RE: Error while creating AssertionIDRequestBuilder



Thanks Chad. I will try it out.



Sumit



> -----Original Message-----

> From: Chad La Joie
[mailto:]

> Sent: Wednesday, May 31, 2006 6:39 PM

> To:


> Subject: Re: Error while creating AssertionIDRequestBuilder

>

> It was a bug in the namespace, I had accidently use the SAML assertion

> namespace. If you get the latest code it should work.

>

> Sumit Shah wrote:

> > All,

> >

> >

> >

> > I am trying to create AssertionIDRequest using the

> > AssertionIDRequestBuilder. I get a NullPointerException while trying

to

> > build the object.

> >

> >

> >

> > Here is the code snippet:

> >

> >

> >

> > XMLObjectBuilderFactory builderFactory =

> > Configuration./getBuilderFactory/();

> >

> > AssertionIDRequestBuilder builder = (AssertionIDRequestBuilder)

> >

builderFactory.getBuilder(AssertionIDRequest./DEFAULT_ELEMENT_NAME/);

> >

> > AssertionIDRequest assertionIDRequest= builder.buildObject();

> >

> >

> >

> >

> >

> > Upon debugging, I checked that the factory contains

"AssertionIDRequest"

> > as the key. But,

> > builderFactory.getBuilder(AssertionIDRequest./DEFAULT_ELEMENT_NAME/)

> > returns a NULL value.

> >

> >

> >

> > I would appreciate any pointers on how to go about creating an

> > AssertionIDRequest.

> >

> >

> >

> > Thanks

> >

> > Sumit

> >

> >

> >

>

> --

> Chad La Joie 2052-C Harris Bldg

> OIS-Middleware 202.687.0124



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



Archive powered by MHonArc 2.6.16.

Top of Page