19 Replies Latest reply on Feb 8, 2008 9:25 PM by HowardTreisman

    Transformation between  xfaform and document types

    kc@dafolo.dk Level 1
      Hi again,

      As I can understand that I cannot send an xfaform as an attachment to an email (but document is ok) I would like to know how I can transform an xfaform (with an xml schema to a document). Do I need to use the exportdata and importdata to do this?.

      It is important to me because I need to retrieve a form by email (in either xml/xdp or pdf) do some manual work in my process and return an email to the user with and answer in the attachment.

      Do you have any best practices for such a scenario?

      Sincerely
      Kim Christensen
      Dafolo A/S
      Denmark
        • 1. Re: Transformation between  xfaform and document types
          Jasmin Charbonneau Level 4
          Usually, you would send the PDF to the end user. An XDP/XML might not make sense to them. This is more a server-side format to ultimately render an output format(usually a PDF).

          So my suggestion is to render the XDP into a PDF and then send the email.

          Let me know if I misunderstood your requirement.

          Jasmin
          • 2. Re: Transformation between  xfaform and document types
            kc@dafolo.dk Level 1
            It seems as you have understood me correctly.

            As I understand you, you are suggesting that I render a PDF from the XDP and store this in a document variable.

            Is this correct?

            So the process would be like the following sketch:

            - Email endpoint receives mail with attachement
            - Attachment is stored as xfaform variable
            - Attachment is handled manually in the process
            - Attachment is rendered to PDF and stored as document variable
            - Attachment is sent back to user

            This is just a short recap, please tell me if the above is not possible.

            Sincerely

            Kim Christensen
            Dafolo A/S
            Denmark
            • 3. Re: Transformation between  xfaform and document types
              Jasmin Charbonneau Level 4
              Yes, that's what I'm saying.

              Or if the endpoint receives mail with attachement as PDF, then just use PDF in the process and submit the PDF back to the user.

              Jasmin
              • 4. Re: Transformation between  xfaform and document types
                aoatak Level 1
                Hi,
                I have a similar process which I retrieve a PDF form from e-mail attachment. And in my workflow, I would like to extract and use(e.g. insert into database) this form data.
                I defined a process variable in both xfaform and document types to hold the PDF form. I couldn't be able to get the e-mail attachment when I defined as xfaform but document is OK (as kcdc did).
                My question is how can I extract data from document variable in my workflow? Can I transform document type to xfaform?
                Do you have any suggestions on invoking a manual process with email endpoints?
                • 5. Re: Transformation between  xfaform and document types
                  Jasmin Charbonneau Level 4
                  You don't need to use an xfaForm variable in your case. You can just use the Form Data Integration service and use the exportData operation. Just use a variable of type XML to hold the data from your PDF.

                  Jasmin
                  • 6. Re: Transformation between  xfaform and document types
                    aoatak Level 1
                    I tried using exportData operation; I defined its input variable as document and output as xfaform and I got the below InvalidCoercionException. Should I use setvalue operation instead?<br /><br />2007-12-05 19:56:13,795 INFO  [com.adobe.idp.scheduler.SchedulerServiceImpl] OneShot Trigger created ----------------------------------------<br />2007-12-05 19:56:13,811 ERROR [com.adobe.workflow.AWS] stalling action-instance: 508 with message: ALC-DSC-119-000: com.adobe.idp.dsc.util.InvalidCoercionException: Cannot coerce object: <document state="passive" senderVersion="3" persistent="true" senderPersistent="false" passivated="true" senderPassivated="true" deserialized="true" senderHostId="127.0.0.1/192.168.100.234" callbackId="0" senderCallbackId="52" callbackRef="null" isLocalizable="true" isTransactionBound="false" defaultDisposalTimeout="600" disposalTimeout="600" maxInlineSize="65536" defaultMaxInlineSize="65536" inlineSize="5896" contentType="null" length="-1"><cacheId/><localBackendId/><globalBackendId/><senderLocalBackendId/><senderGl obalBackendId/><inline><?xml version="1.0" encoding="UTF-8"?><xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1....</inline><senderPullServantJndiName>ad obe/idp/DocumentPullServant/adobejb_server1</senderPullServantJndiName><attributes/></docu ment> of type: com.adobe.idp.Document to type: class com.adobe.idp.taskmanager.form.impl.xfa.XFARepositoryFormInstance<br />     at com.adobe.workflow.datatype.CoercionUtil.toType(CoercionUtil.java:878)<br />     at com.adobe.workflow.datatype.runtime.impl.pojo.POJODataTypeRuntimeHandler.coerceFrom(POJOD ataTypeRuntimeHandler.java:101)<br />     at com.adobe.workflow.datatype.runtime.impl.pojo.POJODataTypeRuntimeHandler.getNode(POJOData TypeRuntimeHandler.java:127)<br />     at com.adobe.workflow.dom.VariableElement.setBoundValue(VariableElement.java:93)<br />     at com.adobe.workflow.pat.service.PATExecutionContextImpl.setProcessDataValue(PATExecutionCo ntextImpl.java:729)<br />     at com.adobe.workflow.engine.PEUtil.invokeAction(PEUtil.java:583)<br />     at com.adobe.workflow.engine.ProcessEngineBMTBean.continueBranchAtAction(ProcessEngineBMTBea n.java:2863)<br />     at com.adobe.workflow.engine.ProcessEngineBMTBean.asyncInvokeProcessCommand(ProcessEngineBMT Bean.java:646)<br />     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />     at java.lang.reflect.Method.invoke(Method.java:585)<br />     at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
                    • 7. Re: Transformation between  xfaform and document types
                      Jasmin Charbonneau Level 4
                      I double checked the parameter and the "Data Extracted" parameter needs to also be a document type. The document variable will contain xml so you can use a SetValue to put the document variable's content in a XML variable (not xfaForm). Like this:

                      /process_data/myXML = /process_data/MyDoc

                      Jasmin
                      • 8. Re: Transformation between  xfaform and document types
                        aoatak Level 1
                        I defined "data extracted" parameter as document and no longer take InvalidCoercionException. And I also used SetValue operation as a second step in my process. But this time I get a different exception.
                        After exportdata operation it tries to send email(which is not defined in my worklow) and fails:

                        2007-12-05 21:20:33,510 INFO [com.adobe.workflow.AWS] Invoking action synchronously
                        2007-12-05 21:20:33,510 INFO [com.adobe.livecycle.formdataintegration.server.FormData] ALC-FDI-001-308: Processing exportData operation on source document 19909875.
                        2007-12-05 21:20:33,603 INFO [com.adobe.workflow.AWS] Invoking action synchronously
                        2007-12-05 21:20:33,775 INFO [com.adobe.idp.dsc.provider.service.email.impl.EmailWriterImpl] EmailWriterImpl error : 501 5.1.7 Invalid address

                        2007-12-05 21:20:33,775 INFO [STDOUT] javax.mail.MessagingException: 501 5.1.7 Invalid address
                        2007-12-05 21:20:33,775 INFO [STDOUT] at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1020)
                        2007-12-05 21:20:33,775 INFO [STDOUT] at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:716)
                        2007-12-05 21:20:33,775 INFO [STDOUT] at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:388)
                        2007-12-05 21:20:33,775 INFO [STDOUT] at com.adobe.idp.dsc.provider.service.email.impl.EmailWriterImpl.send(EmailWriterImpl.java:2 25)
                        2007-12-05 21:20:33,775 INFO [STDOUT] at com.adobe.idp.dsc.provider.service.email.impl.write.EmailResultHandlerImpl.sendResults(Em ailResultHandlerImpl.java:300)
                        2007-12-05 21:20:33,775 INFO [STDOUT] at com.adobe.idp.dsc.provider.service.email.impl.write.EmailResultHandlerImpl.handleSuccess( EmailResultHandlerImpl.java:83)
                        2007-12-05 21:20:33,775 INFO [STDOUT] at com.adobe.idp.dsc.provider.service.email.impl.write.EmailResultHandlerImpl.handleSuccess( EmailResultHandlerImpl.java:72)
                        ...
                        2007-12-05 21:20:33,790 INFO [com.adobe.idp.dsc.provider.service.email.impl.write.EmailResultHandlerImpl] Failed to send email Error = Internal error.
                        2007-12-05 21:20:33,790 INFO [com.adobe.idp.dsc.provider.service.email.impl.write.EmailResultHandlerImpl] Failed to send email, write results to local directory
                        2007-12-05 21:20:33,790 ERROR [com.adobe.idp.Document] DOCS001: Unexpected exception. while saving c:\EmailProvider\kgc\9999999944\071205212027\ResultFiles\*.pdf.
                        java.io.FileNotFoundException: c:\EmailProvider\kgc\9999999944\071205212027\ResultFiles\*.pdf (The filename, directory name, or volume label syntax is incorrect)
                        at java.io.FileOutputStream.open(Native Method)

                        Would it be because of the definitions of variables(other than type attribute), or the processes in the workflow or the system settings?
                        • 9. Re: Transformation between  xfaform and document types
                          Level 1
                          looks like your have a invalid email address in the email part of the process
                          • 10. Re: Transformation between  xfaform and document types
                            aoatak Level 1
                            The email address which I defined as "Inbox User" (in email endpoint definition) on the Host is valid. Because until now I get the attachment from that email address without problem. And I didn't defined another addresss, but what other email address can be part of the process?
                            It seemed to copy the pdf document to ResultFiles directory, is it because of an error occuring at execution of the workflow.
                            • 11. Re: Transformation between  xfaform and document types
                              Jasmin Charbonneau Level 4
                              You need to configure the SMTP address as well. Once the process is finished, it'll send an email back to the sender with any output variables if there are any.

                              Jasmin
                              • 12. Re: Transformation between  xfaform and document types
                                aoatak Level 1
                                I got the point about smtp issue and now I turn to my original problem. I did the conversion as explained in message#7. I have now a variable of type xml with reference to its XSD. Then I would like to extract and use form data using XPATH. I have an expression like
                                /process_data/basvuruFormXML/BasvuruFormu/BasvuruSahibiBil/Adi/tex()
                                Although "Adi" field holds a string value, I get '' out the process.
                                Is anything with the way I do in extracting data?
                                • 13. Re: Transformation between  xfaform and document types
                                  Jasmin Charbonneau Level 4
                                  Use the variable logger and check the content of the XML variable.

                                  Jasmin
                                  • 14. Re: Transformation between  xfaform and document types
                                    aoatak Level 1
                                    I checked the contents of the xml variable by writing it to a text file (by using WriteDocument service). Output file contained form data as:<br /><?xml version="1.0" encoding="UTF-8"?><xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:dd="http://ns.adobe.com/data-description/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.example.org/IsBasvuruFormu/"><br />    <xfa:data><br />        <tns:BasvuruFormu xmlns:tns="http://www.example.org/IsBasvuruFormu/"><br />            <BasvuruSahibiBil><br />                <Adi>KLSJSK</Adi> <!-- this is the element I try to extract --><br />...
                                    • 15. Re: Transformation between  xfaform and document types
                                      Jasmin Charbonneau Level 4
                                      There are namespaces in you xml.

                                      First you need to add them in your process properties. Right click on the process from the Processes view and select properties. Under Advances, you can add the namespaces in the "Registered Prefixes for Namespaces ..."

                                      Add xfa = http://www.xfa.org/schema/xfa-data/1.0/" xmlns
                                      and tns = http://www.example.org/IsBasvuruFormu/

                                      You're xPath should look like
                                      /process_data/basvuruFormXML/xfa:data/tns:BasvuruFormu/BasvuruSahibiBil/Adi

                                      Jasmin
                                      • 16. Re: Transformation between  xfaform and document types
                                        aoatak Level 1
                                        I tried and it worked. Thanks.
                                        • 17. Re: Transformation between  xfaform and document types
                                          Hi Jasmin

                                          I am facing a problem while setting the value of xml data to the XDP form that is used in the workspace. I have retrieved the PDF from data using the export data QPAC.

                                          thanks in advance

                                          regards,
                                          Waqas Ur Rehman
                                          • 18. Re: Transformation between  xfaform and document types
                                            Level 1
                                            What are the problems you are experiencing exactly?

                                            Also, the Service Operation "exportData" of the "FormsDataIntegration" service should be used for PDF submissions (as opposed to XDPs). If you are submitting XDPs then your receiving variable should already contain the XML data you need.

                                            First step, use the Write Document service to write your xdp data to disk to see what it looks like. And to save yourself some time, be sure to use an XML schema in the form design and your Workbench definition of the form.
                                            • 19. Re: Transformation between  xfaform and document types
                                              HowardTreisman Level 1
                                              Just to add to this thread...
                                              One way to simplify the handing of namespaces in xml data, rather than explicitly adding them into the process, is to strip the namespaces out of the source xml.

                                              This is described here in relation to SOAP messages:
                                              http://avoka.dnsalias.com/confluence/display/Public/Processing+XML+Data+with+Arbitrary+Nam espaces+and+Prefixes+within+a+SOAP+Envelope

                                              The advantages are:
                                              - you don't need to add the namespace definitions
                                              - you don't need to manually add the namespace prefixes to the xpath expression, you can just use whatever the xpath expression editor uses.
                                              ie
                                              /process_data/basvuruFormXML/data/BasvuruFormu/BasvuruSahibiBil/Adi
                                              instead of
                                              /process_data/basvuruFormXML/xfa:data/tns:BasvuruFormu/BasvuruSahibiBil/Adi

                                              Howard
                                              http://www.avoka.com