cancel
Showing results for 
Search instead for 
Did you mean: 

WD FileUpload api ...

Former Member
0 Kudos

Is there some WD FileUpload api example code to try?

Im trying to use the File upload in a WD project but i get "com.sap.tc.webdynpro.services.sal.util.cache.WDResourceNotFoundException: Object could not be found in cache, key is null"

I apply all the advises written here in the forum, but I still have the same error.

my problem is, I have to receive two binary files.

so I have two fileUpload components (named fileCert an fileKey)

I have in the custom controller context two nodes (one for each file) with two value atributes (certFile.fileData binary and certFile.fileName String,

keyFile.fileData and keyFile.FileName)

both nodes have 1..n cardinality and 1..n Selection in the node properties

I mapped this nodes to the context of the view and bind them to the data property of the FileUpload UI element

in the action of the button submit i have this code:

wdThis.wdGetNDISAdminCustController().EncodeFileData();

in the wdInit of the custom controller i have:

ICertFileElement certElement = wdContext.createCertFileElement();

wdContext.nodeCertFile().bind(certElement);

IWDAttributeInfo CattInfo = certElement.node().getNodeInfo().getAttribute("fileData");

IWDModifiableBinaryType CbinaryType = (IWDModifiableBinaryType) CattInfo.getModifiableSimpleType();

CbinaryType.setFileName("d:
temp
TestCert.cer");

and the same thing for the keyData attribute:

in the encodeFileData method i have

BASE64Encoder enc64 = new BASE64Encoder();

byte[] bCert = wdThis.wdGetContext().currentCertFileElement().getFileData();

byte[] bKey = wdThis.wdGetContext().currentCertFileElement().getFileData();

String sCert = enc64.encode(bCert);

String sKey = enc64.encode(bKey);

BUT THAT CODE IS NOT EXECUTED cause i get the error just after the submit click and before the execution of the SubmitConfig action linked to the on action property of the button.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Did you already manage to solve this yourself?

Former Member
0 Kudos

Yes, I solve that problem, the problem was the context variable had to be created and binded before it were used, the code was:

...

IInvoiceImgFileElement invImgFile = wdContext.createInvoiceImgFileElement();

wdContext.nodeInvoiceImgFile().bind(invImgFile);

thnks