mace-opensaml-users - Re: Re: How to parse metadata.xml file
Subject: OpenSAML user discussion
List archive
- From:
- To:
- Subject: Re: Re: How to parse metadata.xml file
- Date: Wed, 26 Sep 2007 07:52:50 -0400 (EDT)
Thanks Rod,
It's working, I can read the metadata file.
The manual is now fine.
https://spaces.internet2.edu/display/SHIB/OSTwoUsrManJavaCreateFromXML
The only problem that I had is the InputStream. I changed it to a
FileInputStream for test.
FileInputStream in = new(FileInputStream("C:/dev2/workspace/metadata.xml");
My code:
====================================================================
FileInputStream in = null;
try {
in = new
FileInputStream("C:/dev2/workspace/metadata.xml");
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Initialize the library
try {
DefaultBootstrap.bootstrap();
} catch (ConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Get parser pool manager
BasicParserPool ppMgr = new BasicParserPool();
ppMgr.setNamespaceAware(true);
// Parse metadata file
// InputStream in =
SAML20IDPRequestHandler.class.getResourceAsStream(inCommonMDFile);
Document inCommonMDDoc = null;
try {
inCommonMDDoc = ppMgr.parse(in);
} catch (XMLParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Element metadataRoot = inCommonMDDoc.getDocumentElement();
// Get apropriate unmarshaller
UnmarshallerFactory unmarshallerFactory =
Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller =
unmarshallerFactory.getUnmarshaller(metadataRoot);
// Unmarshall using the document root element, an EntitiesDescriptor
in this case
try {
//EntitiesDescriptor inCommonMD =
(EntitiesDescriptor) unmarshaller.unmarshall(metadataRoot);
EntityDescriptor inCommonMD = (EntityDescriptor)
unmarshaller.unmarshall(metadataRoot);
IDPSSODescriptor logout =
inCommonMD.getIDPSSODescriptor(IDPSSODescriptor.DEFAULT_ELEMENT_LOCAL_NAME);
// logout.getSingleLogoutServices();
// Object inCommonMD = unmarshaller.unmarshall(metadataRoot);
System.out.println("Object: "+ inCommonMD.getClass());
// _systemLogger.log(Level.INFO, inCommonMD.getName());
} catch (UnmarshallingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- How to parse metadata.xml file, nazif . aksay, 09/26/2007
- Re: How to parse metadata.xml file, Rod Widdowson, 09/26/2007
- <Possible follow-up(s)>
- Re: Re: How to parse metadata.xml file, nazif . aksay, 09/26/2007
Archive powered by MHonArc 2.6.16.