on 04-07-2006 12:39 PM
can i access with web dynpro to get xml documents in a folder located in the km in the portal? do you have code, tutorials or info about that (if is possible)
Thanks a lot
Hello,
here is some source code that may help you:
try {
com.sapportals.portal.security.usermanagement.IUser
ep5User = WPUMFactory.getServiceUserFactory().getServiceUser(QUICKLINK_USER);
ResourceContext context = new ResourceContext(ep5User);
/*Give the path to KM in the variable path */
RID rid = RID.getRID("folder/path");
IResourceFactory factory = ResourceFactory.getInstance();
ICollection folder = (ICollection) factory.getResource(rid, context);
IResource resource = ResourceFactory.getInstance().getResource(RID.getRID("folder/path/file.xml"), context);
if (resource != null) {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbFactory.newDocumentBuilder();
Document document = builder.parse(resource.getUnfilteredContent().getInputStream());
// Here you can do your XML Stuff
else {
// File not found error handling goes here
}
Hope it helps as a start point.
Have a nice weekend,
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I am getting java.lang.ClassCastException during casting from IResource to ICollection while running this code
try {
IWDClientUser wdClientUser1 = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser1 = wdClientUser1.getSAPUser();
com.sapportals.portal.security.usermanagement.IUser
ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser1);
ResourceContext context = new ResourceContext(ep5User);
IResourceFactory resourceFactory = ResourceFactory.getInstance();
/*Give the path to KM in the variable path */
RID rid = RID.getRID(wdContext.currentContextElement().getPath());
wdComponentAPI.getMessageManager().reportSuccess("rid "+rid);
IResource resource = resourceFactory.getResource(rid, context);
IResourceFactory factory = ResourceFactory.getInstance();
try{
ICollection folder = (ICollection)resource;
// wdComponentAPI.getMessageManager().reportSuccess("folder "+folder);
// IResourceList resourceList = folder.getChildren();
// IResourceListIterator resourceListIterator = resourceList.listIterator();
resource = ResourceFactory.getInstance().getResource(RID.getRID(wdContext.currentContextElement().getPath()), context);
wdComponentAPI.getMessageManager().reportSuccess("resource "+resource);
if (resource != null) {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbFactory.newDocumentBuilder();
Document document = builder.parse(resource.getUnfilteredContent().getInputStream());
}
// Here you can do your XML Stuff
else {
// File not found error handling goes here
}
}catch(Exception e1){
wdComponentAPI.getMessageManager().reportSuccess("e1 "+e1);
}
}catch(Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess("err "+e);
}
please reply
Sajith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jose,
Did you check Tutorial "Using Knowledge Management Functions in Web Dynpro (26)" https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial on using knowledge management functions in web dynpro - 26.htm
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.