Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] Unmarshall and validating an SAML file

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] Unmarshall and validating an SAML file


Chronological Thread 
  • From: murali mca <>
  • To:
  • Subject: Re: [OpenSAML] Unmarshall and validating an SAML file
  • Date: Fri, 23 Oct 2009 17:22:41 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=rRsS3KXv59L2f7lSohw7V6jR30UP5QoydmC3ZBE8AKQd9X89YhhiJjIPqWrNbuJ8UROcQhCYwXBVooZoW40fpobaAADyPfmbwyRzgeJiyDePXLoDSQ6bL1X8XlXcTQUWpfhoM4D9DV7fDLWcGm8/IEXD/dvHPduuIkQj3mULynI=;

Hi
Thanks for reply.
I have got the SAML with namespace and now am able to resolve the "SAXParseException".
 

String fileName = "C:/Users/SamlResponse.xml";

BasicParserPool ppMgr = new BasicParserPool();

ppMgr.setNamespaceAware(true);

Document inCommonMDDoc;

FileInputStream in = new FileInputStream(new File(fileName));

try{

inCommonMDDoc = ppMgr.parse(in);

Element responseRoot = inCommonMDDoc.getDocumentElement();

System.out.println("responseRoot  is:"+responseRoot);

 

UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();

Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(responseRoot);

 

Response samlresponse = (Response) unmarshaller.unmarshall(responseRoot);

 

}catch (XMLParserException e){

e.printStackTrace();

}catch (UnmarshallingException e){

e.printStackTrace();

}

When I ran the above piece of code, I am presenting with
responseRoot: null
"Exception in thread "main" java.lang.NullPointerException "
 
I am getting the "null", at this  line. Element responseRoot = inCommonMDDoc.getDocumentElement();
Please could you correct me if I am doing wrong in mycode.
 
Thanks
Regards

--- On Fri, 23/10/09, Brent Putman <> wrote:

From: Brent Putman <>
Subject: Re: [OpenSAML] Unmarshall and validating an SAML file
To:
Date: Friday, 23 October, 2009, 4:26 AM

If your file data is literally as you originally posted, for example:

<Response IssueInstant="2009-09-04T13:37:33Z" MajorVersion="1"
MinorVersion="1" ID="1bc6d017-f9bd-4333-a618-a73cd4ea51ac">


then it is in fact invalid, b/c you don't have any namespace
declarations in there at all. SAML (both v1 and v 2) is always
namespace-qualified.  The schema validation is then correctly reporting
that it does not know about any declaration for a (non-namespace
qualified) Element called 'Response'.

You need to add the appropriate namespace declarations to you SAML data.

--Brent




murali mca wrote:
>
> Thanks for the reply.

> After using FileInputStream,I am able to get rid of the error. Now I
> am getting with below  "SAX ParserException" error.

> org.xml.sax.SAXParseException
> : cvc-elt.1: Cannot find the declaration of element 'Response'.
> a
>


From cricket scores to your friends. Try the Yahoo! India Homepage!


Archive powered by MHonArc 2.6.16.

Top of Page