Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Process with RenderPDFForm using Java API not generating output file

Avatar

Level 2

I have a short-lived process that renders a PDF/HTML form based on input parameters. It also takes a .xdp file as input. This works just fine from with

in Workbench (9.0). I have created a Java client to invoke this process. When I invoke the process from the Java Client,

it is not creating the output file. When I look at the invocation response, I see the output parameter (output file) name, but it is null.

Here is my code.

Properties connectionProps =

new Properties();

connectionProps.setProperty(

"DSC_DEFAULT_SOAP_ENDPOINT", "http://hostname:8080");

connectionProps.setProperty(

"DSC_TRANSPORT_PROTOCOL","SOAP");

connectionProps.setProperty(

"DSC_SERVER_TYPE", "JBoss");

connectionProps.setProperty(

"DSC_CREDENTIAL_USERNAME", "username");

connectionProps.setProperty(

"DSC_CREDENTIAL_PASSWORD", "password");

//Create a ServiceClientFactory object

ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

//Create a ServiceClient object

ServiceClient myServiceClient = myFactory.getServiceClient();

//Create a Map object to store the parameter value

Map params =

new HashMap();

File file =

new File("C:/test1/test.xdp");

File ofile =

new File("C:/TestProcess.pdf");

//String formName = "RD410-4.xdp";

InputStream inFile =

new FileInputStream(file);

OutputStream oFileStream =

new FileOutputStream(ofile);

byte[] cData = "".getBytes();

 

Document inputData =

new Document(inFile);

// Document outputData = new Document(oFileStream);

inputData.passivate();

 

params.put(

"Form", inputData);

params.put(

"FormId", "12");

params.put(

"RevId", "12");

params.put(

"OutputType", "PDF");

params.put(

"targetSubmission", "http://localhost:8090/LCWebProject/HandleData");

params.put(

"param1",1);

InvocationRequest invokeRequest = myFactory.createInvocationRequest(

"MyApplication10/Processes/RenderForm", //Specify the short-lived process name

"invoke", //Specify the operation name

params,

//Specify input values

true); //Create a synchronous request

InvocationResponse invokeresponse = myServiceClient.invoke(invokeRequest);

Document encryptDoc = (Document) invokeresponse.getOutputParameter(

"outputFile");

//Save the encrypted PDF document returned by the process

//Save the password-encrypted PDF document

File outFile =

new File("C:\\test1.pdf");

encryptDoc.copyToFile (outFile);

 

I see the output parameter "outputFile" in the invokeresponse object. But it is null.

Can anyone guide me in the right direction ?

Thanks,

Jyothi

0 Replies