Hi,
I am new to LiveCycle and I want to use the API to integrate it in Weblogic and control it from our own code. First question is, since I only need the API, what setup do I need to perform? Is simply copying all the jar files, such as formserver-client.jar to my web-inf/lib directory enough? (I would think so).
Second, I tried the example code to render a PDF. It is a simple servlet to call EJBClient class to render it. However, I got this error msg from WebLogic:
Exception error is: javax.naming.NameNotFoundException: While trying to lookup 'ejb.com.adobe/formServer/FormServer' didn't find subcontext 'com'. Resolved 'ejb'; remaining name 'com/adobe/formServer/FormServer'
I am not sure what this is. The servlet code is this:
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// Create a EJBClient object
EJBClient formServer = new EJBClient();
// Declare and populate local variables to pass to renderForm
String sFormQuery = "SLNrenderPDF.xdp"; // Defines the form design to render
String sFormPreference = "PDFForm"; // Defines the preference option
String sContentRootURI = "http://172.18.35.198:7001/ois/forms";
String sTargetURL = "http://172.18.35.198:7001/ois/HandleFormSubmit";
String sApplicationWebRoot = "http://172.18.35.198:7001/ois/";
byte[] cData = new byte[0]; // cData
// Create a Hashtable object
Hashtable propsJNDI = new Hashtable();
//// Populate the Hashtable object with JNDI environment values
propsJNDI.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
propsJNDI.put("java.naming.provider.url","t3://172.18.35.198:7001");
try {
// Create an InitialContext object
InitialContext initialContextOb = new InitialContext(propsJNDI);
// Call the EJBClient objects setInitialContext object
formServer.setInitialContext(initialContextOb);
// Call renderForm
IOutputContext myOutputContext = formServer.renderForm(sFormQuery, // sFormQuery
sFormPreference, // sFormPreference
cData, // cData,
"CacheEnabled=False", // sOptions
null, // sUserAgent,
sApplicationWebRoot, // sApplicationWebRoot
sTargetURL, // sTargetURL
sContentRootURI, // sContentRootURI
null // sBaseURL
);
// Create a ServletOutputStream object
ServletOutputStream oOutput = resp.getOutputStream();
// Set the HTTPResponse objects content type
resp.setContentType(myOutputContext.getContentType());
// Get the length of the output stream
int outLength = myOutputContext.getOutputContent().length;
// Create a byte array and allocate outLength bytes
byte[] cContent = new byte[outLength];
// Populate the byte array by invoking getOutputContext
cContent = myOutputContext.getOutputContent();
// Write a byte stream back to the web browser. Pass the byte array
oOutput.write(cContent);
}
// Catch a thrown exception
catch (Exception ioEx) {
System.out.println("Exception error is: " + ioEx.getMessage());
}
}
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doPost(req, resp);
}
Any help would be greatly appreciated. Thanks,