Hi,
I have written a documentum workflow method which generates xml files dynamically and send it to the adobe server to convert the xml file to pdf and return the pdf document.When I ran the code from my local machine it is working fine,but when I deployed the code in the Documentum Server where JBoss is the application server,the code is throwing null in getting a InvocationResponse object,
Below the code I have written
public class PDFTemplateWorkflow extends WorkflowMethod {
private static final String REQUEST_PACKAGE = "Package0";
private static final String FEE_PACKAGE = "Package1";
public int doTask(IDfWorkitem workitem, IDfProperties activityParameters,
PrintWriter printWriter) throws Exception
{
/*Read the activity parameters */
System.out.println("Entering into doTask Method");
String requestPackage =activityParameters.getString(REQUEST_PACKAGE);
System.out.println("First Package is "+requestPackage);
String feePackage =activityParameters.getString(FEE_PACKAGE);
System.out.println("Second Package is"+feePackage);
Properties ConnectionProps = new Properties();
ServiceClientFactory factory = null;
IDfSession session = null;
String DocumentID = null;
String prepopulatedValues=null;
HashMap params1 = new HashMap();
HashMap params2 = new HashMap();
Object application_id=null;
String LoginName;
String Address;
String formName;
String DocumentumFolderPath;
String operationName="FEE_PAYMENT";
String applicationName="FEE_PAYMENT";
try{
//Set connection properties required to invoke LiveCycle ES2
ConnectionProps.setProperty("DSC_DEFAULT_SOAP_ENDPOINT", "http://hydhtc137429d:8080");
ConnectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","SOAP");
ConnectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");
ConnectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
ConnectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");
// Create a ServiceClientFactory instance
factory = ServiceClientFactory.createInstance(ConnectionProps);
ServiceClient myServiceClient = factory.getServiceClient();
System.out.println("ServiceClient Object is "+myServiceClient);
Date currentDate = new Date();
SimpleDateFormat formatter= new SimpleDateFormat("dd/MM/yyyy");
String dateNow = formatter.format(currentDate);
System.out.println("Now the date is :=> " + dateNow);
if (workitem instanceof IDfWorkitemEx) {
IDfWorkitemEx workitemEx = (IDfWorkitemEx) workitem;
application_id = workitemEx.getPrimitiveVariableValue("application_id");
System.out.println("Application id of the document is"+application_id);
}
session=workitem.getSession();
LoginName=session.getLoginUserName();
Address=LoginName + "Park Street";
DocumentumFolderPath = "/Infy_test/Adobe_Test/"+application_id;
formName = "FeePayment_"+application_id;
prepopulatedValues = "<PaymentLetter>"
+ "<ApplicationID>" + application_id + "</ApplicationID>"
+ "<Date>" + dateNow + "</Date>"
+ "<ApplicantName>" + LoginName + "</ApplicantName>"
+ "<ApplicantAddress>" + Address + "</ApplicantAddress>"
+ "</PaymentLetter>";
System.out.println("xml structure is : " + prepopulatedValues);
//writing into xml file
FileWriter fstreamout = new FileWriter("F:/Adobe/FeePayment.xml");
BufferedWriter out = new BufferedWriter(fstreamout);
out.write(prepopulatedValues);
//Close the output stream
out.close();
File ImageXML = new File("F:/Adobe/FeePayment.xml");
InputStream inXML = new FileInputStream(ImageXML);
Document inputXML = new Document(inXML);
params1.put("InputFormData", inputXML);
params1.put("InputFormName", "FormatofPaymentLetter.pdf");
//Create an InvocationRequest object to send request to Adobe to create pdf file
System.out.println("Entering first method to transform xml to pdf");
InvocationRequest request = factory.createInvocationRequest(
"EndtoEndFlow/RenderForm", //Specify the short-lived process name
"invoke", //Specify the operation name
params1, //Specify input values
true); //Create a synchronous request
//Send the invocation request to the short-lived process and
//get back an invocation response -- outDoc refers to the output parameter for the
System.out.println("request object is "+request);
System.out.println("till this point success");
InvocationResponse response = myServiceClient.invoke(request);
System.out.println("response object is "+response);
Document myPDFfile = (Document)response.getOutputParameter("ReaderExtendedForm");
System.out.println("pdf file is"+myPDFfile);
System.out.println("final sucess");
//writing the pdf to the file
InputStream tempStream = myPDFfile.getInputStream();
File f = new File("F:/Adobe/FeePayment.pdf");
OutputStream outStream=new FileOutputStream(f);
byte buf[]=new byte[(int) myPDFfile.length()];
int len;
while((len=tempStream.read(buf))>0)
outStream.write(buf,0,len);
outStream.close();
tempStream.close();
//end of first invocation method
IDfSysObject sysobject=(IDfSysObject) session.newObject("sebi_reg_document");
System.out.println("creating an instance of sebi_reg_document object");
sysobject.setObjectName(formName);
sysobject.setString("applicant_name", applicationName);
sysobject.setString("application_id", application_id.toString());
sysobject.setString("operation_name", operationName);
sysobject.setString("a_content_type", "pdf");
sysobject.setPath("F:/Adobe/FeePayment.pdf", "pdf", 0, null);
sysobject.link(DocumentumFolderPath);
sysobject.save();
String r_object_id=sysobject.getString("r_object_id");
System.out.println("Document id created is "+r_object_id);
IDfId id=new DfId(r_object_id);
System.out.println("Document successfully created in Docbase");
workitem.addAttachment("Package1", id);
}
catch(Exception e){
System.out.println(e.getMessage());
}
return 0;
}
}
Can soneone please help me on this
Regards,
Sunil
Views
Replies
Total Likes
You might get some help from this http://www.adobe.com/devnet/livecycle/articles/java_servlets.html
Thanks
Pankaj Gakhar
Views
Replies
Total Likes