hi,
I'm using ES4 renderPDFForm service to render pdf along with attachment.
This service works if I dont have PDF attachment but doesn't work PDF with attachments.
I'm sending the PDF attachment like below.
Map attachments = new Map();
MapItem item = new MapItem();
itme.setKey("attachment");
byte[] pdfAttachment = new byte[10,20,30...]
com.adobe.idp.Document doc = new com.adobe.idp.Document(pdfAttachment );
item.setValue(doc);
attachments .add(item);
service.renderPDFForm("CORR0040-MiscellaneousMS-8.xdp", inputData, renderSpec, spec, attachments);
Error I'm getting is: javax.xml.ws.soap.SOAPFaultException: java.lang.ClassCastException: java.lang.String incompatible with com.adobe.idp.Document
Please help me how to resolve this...
See if below helps :
================================================ renderPDFForm2==================================================================
Map attach = new HashMap();
String attachmemntfilename = "Attachment.pdf";
Document attachmemntfile = new Document(new FileInputStream("C:\\Users\\Administrator\\Desktop\\Testing.pdf"));
attach.put(attachmemntfilename, attachmemntfile);
Document formQuery = new Document(new FileInputStream("C:\\Users\\Administrator\\Desktop\\PreLoanForm.xdp"));
Document oInputData = new Document(new FileInputStream("C:\\Users\\Administrator\\Desktop\\firstAppTestData.xml"));
FormsResult formOut = formsClient.renderPDFForm2(formQuery, // formQuery
oInputData, // inDataDoc
pdfFormRenderSpec, // PDFFormRenderSpec
uriValues, // urlSpec
attach // attachments
);
// Create a Document object that stores form data
Document myData = formOut.getOutputContent();
myData.copyToFile(new File("OutputPDF.pdf"));
================================================= renderPDFForm ============================================================
FormsServiceClient formsClient = new FormsServiceClient(myFactory);
// Set the parameter values for the renderPDFForm method
String formName = "PreLoanForm.xdp";
Document formQuery = new Document(new FileInputStream("C:\\Users\\Administrator\\Desktop\\PreLoanForm.xdp"));
Map attach = new HashMap();
String attachmemntfilename = "Attachment.pdf";
Document attachmemntfile = new Document(new FileInputStream("C:\\Users\\Administrator\\Desktop\\Testing.pdf"));
attach.put(attachmemntfilename, attachmemntfile);
byte[] cData = "".getBytes();
Document oInputData = new Document(new FileInputStream("C:\\Users\\Administrator\\Desktop\\firstAppTestData.xml"));
// Set run-time options using a PDFFormRenderSpec instance
PDFFormRenderSpec pdfFormRenderSpec = new PDFFormRenderSpec();
pdfFormRenderSpec.setCacheEnabled(new Boolean(true));
pdfFormRenderSpec.setAcrobatVersion(AcrobatVersion.Acrobat_9);
// Specify URI values that are required to render a form
URLSpec uriValues = new URLSpec();
uriValues.setContentRootURI("repository:///Applications/FirstAppSolution/1.0/");
FormsResult formOut = formsClient.renderPDFForm(formName, // formQuery
oInputData, // inDataDoc
pdfFormRenderSpec, // PDFFormRenderSpec
uriValues, // urlSpec
attach // attachments
);
// Create a Document object that stores form data
Document myData = formOut.getOutputContent();
myData.copyToFile(new File("OutputPDF.pdf"));
Thanks,
Wasil
Wasil,
Thanks for the reply what version of WSDL is this? I'm using 11.0 but not supported Java.Util.HashMap, it only supports import org.apache.xml.xml_soap.Map;
Here is my renderForm XSD:
<element name="renderPDFForm">
<complexType>
<sequence>
<element maxOccurs="1" minOccurs="0" name="formQuery" type="xsd:string" />
<element maxOccurs="1" minOccurs="0" name="inDataDoc" type="impl:BLOB" />
<element maxOccurs="1" minOccurs="0" name="pdfFormRenderSpec" type="impl:PDFFormRenderSpec" />
<element maxOccurs="1" minOccurs="0" name="urlSpec" type="impl:URLSpec" />
<element maxOccurs="1" minOccurs="0" name="attachments" type="apachesoap:Map" />
</sequence>
</complexType>
</element>
Views
Replies
Total Likes
@WASIL: please let me know what version are you using...
Views
Replies
Total Likes
That was done by using SDK. I'll try by consuming WSDL, generating proxy classes.
-Wasil
Views
Replies
Total Likes
Wasil,
Have you got a chance to try it ?
Views
Replies
Total Likes
Wasil,
I tried still getting the same error...
javax.xml.ws.soap.SOAPFaultException: java.lang.ClassCastException: java.lang.String incompatible with com.adobe.idp.Document
Views
Replies
Total Likes
The above code I shared was tested using SDK. Are you using LiveCycle SDK ? Please share your code.
Thanks
Wasil
Views
Replies
Total Likes
Thanks for the reply, here is my code..
I'm using ES4
public GenerateDocumentResponse generateDocument(GenerateDocumentRequest
generateDocumentRequest) throws SystemFault, ValidationFault
myLogger.info("invoking ES4 Tech Service...");
System.out.println("invoking ES4 Tech Service...");
com.adobe.idp.services.FormsService service = getAdobeES4RenderService();
BLOB inputData = ES4DataTransformer.transformInputData(templatesList);
inputData.setContentType(contentType);
PDFFormRenderSpec renderSpec = new PDFFormRenderSpec();
renderSpec.setCacheEnabled(new Boolean(true));
URLSpec spec = new URLSpec();
spec.setContentRootURI(ReadProperties.getValue(ES4_CONTENT_ROOT_URI));
spec.setBaseURL(ReadProperties.getValue(ES4_REMOTE_URL));
Map attachments = ES4DataTransformer.populateAttachments(templatesList);
System.out.println("Renderfom is about to invoke:::");
service.renderPDFForm(templatePath, inputData, renderSpec, spec,attachments, outRenderFormResultDoc, pageCount, locale, formResult);
response = new GenerateDocumentResponse();
return response;
}
public static Map populateAttachments(List<DocumentTemplate> templatesList){
Map attachments = new Map();
List<MapItem> items = attachments.getItem();
if(null == items){
items = new ArrayList<MapItem> ();
}
for(DocumentTemplate template: templatesList){
if(null != template){
List<DocumentAttachmentDataType> attachmentList = template.getAttachments();
if(null != attachmentList ){
int i = 0;
for(DocumentAttachmentDataType dataType: attachmentList){
MapItem item = new MapItem();
byte[] attachmentData = dataType.getAttachment();
com.adobe.idp.Document doc = new com.adobe.idp.Document(attachmentData);
item.setKey("CDT00000000003933811.xdp");
item.setValue(doc);
items.add(item);
++i;
}
}
}
}
return attachments;
}
Views
Replies
Total Likes
You are using the WSDL generated proxy classes, not SDK. Previously,I also found some issues with the generated proxy classes API. Did you contact Enterprise Support regarding this ?
If not, please contact Enterprise Support so that this could be worked upon in case it is a bug.
-Wasil
Views
Replies
Total Likes
Nope. Not contacted. Woul you pls give me their email id where I can reach them
Thanks
TPReddy
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies