cancel
Showing results for 
Search instead for 
Did you mean: 

KM Content retrieval

Former Member
0 Kudos

Hello,

When I try to retrieve content from KM using this code:


IResourceFactory factory = ResourceFactory.getInstance();
IResource resource = factory.getResource(rid, context);
			
IContent content = resource.getContent();

I get a <i>wcm.repository.ResourceException: Operation getContent(com.sap.netweaver.bc.rf.common.IResourceHandle) is not yet supported/implemented!</i> exception.

I think my code is the same I have found in the examples.

Does anyone know what I am doing wrong?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Oh! You were right, I think I got it.

Thanks!.

detlev_beutner
Active Contributor
0 Kudos

Hi Antonio,

does this mean the question is solved? In this case, please mark it as solved (and consider rewarding corresponding points). If not, feel free to ask further questions...

Best regards

Detlev

Former Member
0 Kudos

I understand that I have to code my own repository manager in order to retrieve resource content.

Is that correct?

detlev_beutner
Active Contributor
0 Kudos

Hi Antonio,

> I have to code my own repository manager

> in order to retrieve resource content

No, not at all! The code you're using looks fine at a first glance. The question is: What RID did you use (maybe you tried to look up some repository content where this is not supported)?

Maybe you can strip down your code to a few lines so that the exception still occurs (no extra line) and offer the whole (then: little) class, so we could also check the imports etc.

Hope it helps

Detlev

Former Member
0 Kudos

Hi Detlev,

I am developing a web service to upload and download content into and from KM. When I upload a document I get a shortID (for example /guid/2092cec9-8f11-2810-2da9-dafd37c35f45) and that's what I use to try to retrive the document. I get it by using a IUriMapperService.

I checked the shortID I got from my "uploader" and it is the same that document properties shows. So it is correct.

This is my code:


public byte[] getDocument(String documentRID) {

		com.sapportals.portal.security.usermanagement.IUser iUser = null;
		
		RID rid = RID.getRID(documentRID);
		
		try {
			
			iUser =	WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
			
			IResourceContext context = new ResourceContext(iUser);
			 
			IResourceFactory factory = ResourceFactory.getInstance();
			IResource resource = factory.getResource(rid, context);
			
			IContent content = resource.getContent();
			
			....

At that point I get the exception.

Thanks.

Message was edited by: Antonio David Ramírez Moreno

detlev_beutner
Active Contributor
0 Kudos

Hi Antonio,

so in fact the documentRID string you get passed is a guid RID?! In this case, try to convert it using <i>getRIDFromGuidRID</i> (from IUriMapperService).

Hope it helps

Detlev

Former Member
0 Kudos

It worked!

Thank you VERY MUCH!

0 Kudos

helo Antonio

i have so question, please post your final source code.

regards

Douglas.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Refer this thread may help you

Regards,

RK

Former Member
0 Kudos

Thanks Ramakrishna, but those documents shows the same code I'm using.

Any other idea?

Thanks.