cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading files to KM repository using Webdynpro APIs

Former Member
0 Kudos

Hi All,

I was reading the following blog /people/rohit.radhakrishnan/blog/2005/05/27/uploading-files-to-km-repository-using-webdynpro-apis and I was trying to upload a document from a URL for example http:/ntek.com.mx/wp-content/uploads/2008/12/sap_logo1.gif

So far I am getting the following error:

http:/ntek.com.mx/wp-content/uploads/2008/12/sap_logo1.gif (No such file or directory (errno:2))

Any Ideas?

Regards,

Orlando Covault

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos
Former Member
0 Kudos
Former Member
0 Kudos

Hi Jay,

So far I think I followed all the intructions given in the links you provide. This is the snipped code

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try {

String path = "/documents";

IResourceContext resourceContext = buildResourceContext();

// get a resource factory

IResourceFactory resourceFactory = ResourceFactory.getInstance();

// Get a RID from the current path to display the according content

RID pathRID = RID.getRID(path);

// Get a Iresource object to work on

ICollection folder =

(ICollection) resourceFactory.getResource(

pathRID,

resourceContext);

String templateUrl =

WDURLGenerator.getResourcePath(

wdComponentAPI.getDeployableObjectPart(),

"PositionModPDFView_InteractiveForm.xdp");

File file = new File(templateUrl);

FileInputStream template = new FileInputStream(file);

manager.reportWarning(template.toString());

if (template != null) {

template.read();

Content content = new Content(template, "byte", -1L);

manager.reportWarning(content.getContentType());

IResource newResource =

folder.createResource("sap_logo1.gif", null, content);

template.close();

}else{

manager.reportException("Documento Vacio",false);

}

} catch (ResourceException e) {

// TODO Auto-generated catch block

manager.reportException(e.getLocalizedMessage(), false);

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

manager.reportException(e.getLocalizedMessage(), false);

} catch (IOException e) {

// TODO Auto-generated catch block

manager.reportException(e.getLocalizedMessage(), false);

} catch (ContentException e) {

// TODO Auto-generated catch block

manager.reportException(e.getLocalizedMessage(), false);

} catch (WDAliasResolvingException e) {

// TODO Auto-generated catch block

manager.reportException(e.getLocalizedMessage(), false);

}

But I am still getting the same error: http://ntek.com.mx/wp-content/uploads/2008/12/sap_logo1.gif(No such file or directory (errno:2)) . Any Idea of what could be wriong?

Regards,

Orlando Covault