I'm uploading a file using an XPage with the standard file upload control. On the datasource I have a WebQuerySave agent.
WQS-agent is in LotusScript.
The user is uploading an XML file and we've got an existing helper library to help parse the XML being uploaded - that's why the WQS is in LotusScript.
Since I cant detach the uploaded file to the server, I'm calling a Java agent to just read the XML to a string and store that in the document.
I'm calling the Java agent using a param document, all basic stuff.
In the param doc I include the UniversalID of the document that contains the attachment and here's my problem!
The Java agent claims that the UniversalID is invalid:
"HTTP JVM: 4091 Invalid universal id"
But if I try to locate the document in the LotusScript agent, before calling the Java agent the document is found using the same UNID: Set tempDoc = db.Getdocumentbyunid(unid)
The Java code:
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import lotus.domino.Agent;
import lotus.domino.AgentBase;
import lotus.domino.AgentContext;
import lotus.domino.Database;
import lotus.domino.Document;
import lotus.domino.NotesException;
import lotus.domino.Session;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Database db = agentContext.getCurrentDatabase();
Agent agent = agentContext.getCurrentAgent();
// Get document used for passing data
System.out.println(agent.getParameterDocID());
Document paramDoc = db.getDocumentByID(agent.getParameterDocID());
String UniversalID = paramDoc.getItemValueString("unid");
System.out.println(UniversalID);
Document doc = db.getDocumentByUNID(UniversalID);
When I run the Java agent I won't get anything from the print commands, but maybe that's expected...(?)
If I run everything manually on an existing document it works. But not on a document submitted thru the browsers.
To me it feels like the document containing the attachment isn't ready yet to Java.
Domino 8.5.3
Any help very much appreciated!
/J
P.S. I'm a Java newbie, so U know.. ;-)