Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Email receiver QPAC does not retrieve attachments other than .jar

Avatar

Former Community Member
Hi,



I'm currently experimenting with the email receiver QPAC. Unfortunately, I didn't succeed in convincing the QPAC to retrieve attachments. The QPAC's testing-tab indicates "Attachment Count:0" for .xml, .pdf, .xdp and even for image type files. Weirdly, .jar-attachments are retrieved indeed!



Also the QPAC seems to mix emails using the subject of one mail and the body of another, if there are multiple emails on the server. Furthermore, the field "received date" always reads "null".



Has anyone had the same problem using the email receiver QPAC?

I'm quite frustrated after a week of testing. :-(



Sincerely,

Steve
18 Replies

Avatar

Level 9
Hi Steve



Make sure you're email EmailReceiver from the latest Workflow SDK (7.0.2).



Try leaving the mime type and attachment name blank - the mime type, in particular, is not always set to what you think it should be by the email clients.



Have you gotten the test tab working - this is often a very good way of testing basic functionality? You do however, need to add the Javamail libraries to the classpath in order to get this working. This is not supported in the default install - how to do this is described in a document you can download from the Avoka web site. Download the SQPLus QPAC at: http://www.avoka.com/avoka/qpac_library.shtml



I find it very unlikely that subject and body are being mixed up - please retest this. I will run some tests on the received-date.



If you're still having problems, repost on this forum.



Regards,

Howard

http://www.avoka.com

Avatar

Former Community Member
Hi Howard,



I'm using email receiver QPAC 7.01.

I got the testing tab working, following your details in the posting
EmailReceiver Qpac testing-tab.



In the testing tab, the attachment count is always 0 for .pdf, .xdp, xml and image type attachments. No attachments are found

> Attachment Count:0

> listing attachments found...

> filename[0]: Not found!



If I send .jar files, the testing tab's attachment counter correctly displays the attachment and its size

> Listing all attachments...:

> Filename: test.jar, Content Type: application/octet-stream;

> name="test.jar"

> Listing attachments found...

> Filename[0]: test.jar



I'm initiating a process using an offline form, whose data is sent by mail to the workflow server. In the form, I included the ws-fields. The workflow gets initiated successfully. I then try to store the .xdp attachment in a form-variable, whose URL points to the original form.

Have you got an example workflow, you may export to xml and email me or post in this forum?



Greetings,

Steve

Avatar

Level 9
Hi Steve

The "Not Found!" implies that either there was no attachment, or no matching attachment. Please make both the name and mime type of your required attachment blank, and see if that works.



I've also built a small sample for the EmailReceiver QPAC.

It consists of a form whose data you can submit as an attachment to an email to a POP account. A workflow then pulls the data from the email, and populates a form variable. It then assigns the form to a user for review.



You can download the workflow, the form and an updated version of the EmailReceiver QPAC from:

http://www.avoka.com/samples/EmailReceiver



You will need to make some minor modifications to the form and the workflow to point it at your own custom email account. I suggest you experiment with a test email account if possible, just in case.



Regards,

Howard

Avatar

Former Community Member
Hi Howard,



thank you very much for providing an example application!

Unfortunately, it didn't work for me out of the box, the process gets not initiated.



In Workflow Designer in the workflow I then included an init-form and in the form to be sent I included the workflow-fields as detailed in
Initiating a workflow process via email.

The process then got initiated.



Still, attachments don't seem to get recognized.

In the Livecycle Administration in process manager the process runs forever with the component 'Wait for email'. If I manually stop the process, a new entry occurs in the 'stalled actions': 'Str->Form'. The error reads:

> com.adobe.workflow.datatype.InvalidCoercionException: Cannot coerce object: com.adobe.workflow.dom.VariableAttr@138a270 of type:

>

com.adobe.workflow.dom.VariableAttr to type: com.adobe.workflow.datatype.form.FormDataTypeInstance

> ...



Is the 'cannot coerce object' error related to the email receiver being unable to retrieve any attachment?

Avatar

Former Community Member
Apparently, I quite misunderstood the way the email receiver QPAC interacts with Workflow server. :-) Sorry for having bothered you with silly questions. Now, I got the workflow working!



Still I get the 'cannot coerce object' exception. The example workflow stalls executing the task 'Str -> Form'.

> com.adobe.workflow.datatype.InvalidCoercionException: Cannot coerce object: com.adobe.workflow.dom.VariableAttr@7935a1 of type:

>

com.adobe.workflow.dom.VariableAttr to type: com.adobe.workflow.datatype.form.FormDataTypeInstance

>

at com.adobe.workflow.datatype.form.FormDataHandler.coerceFrom(FormDataHandler.java:220)

>

at com.adobe.workflow.datatype.AbstractComplexDataTypeHandler.getNode(AbstractComplexDataTypeHandler.java:42)

>

at com.adobe.workflow.dom.VariableElement.setBoundValue(VariableElement.java:72)

>

at com.adobe.workflow.pat.service.PATExecutionContextImpl.setProcessDataValue(PATExecutionContextImpl.java:398)

>

at com.adobe.workflow.pat.service.PATExecutionContextImpl.setProcessDataWithExpression(PATExecutionContextImpl.java:310)

>

at com.adobe.workflow.qpac.set_value.SetValueService.execute(SetValueService.java:72)

>

at com.adobe.workflow.engine.PEUtil.executeAction(PEUtil.java:184)

>

at com.adobe.workflow.engine.ProcessEngineBMTBean.continueBranchAtAction(ProcessEngineBMTBean.java:2320)

>

at com.adobe.workflow.engine.ProcessEngineBMTBean.asyncContinueBranchCommand(ProcessEngineBMTBean.java:1903)

>

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

>

[...]



Howard, in the forum thread
Question about Email Receiver QPAC you told Rob to provide a patch. Does this patch solves the 'cannot coerce object' problem?

Avatar

Level 9
Hi



Glad you've clarified your problem with EmailReceiver.



The problem you're describing above is nothing to do with EmailReceiver - it's actually happening in a SetValue qpac.

What are you trying to achieve?



Howard

Avatar

Level 9
Oops, it looks like that's my sample you're trying to run.

I think I uploaded the wrong version - will check asap and resubmit.

Apologies for the confusion.

Howard

Avatar

Former Community Member
Did anyone get the 'cannot coerce object' exception as well? Am I the only one having problems in handling workflow variables? :-o

Avatar

Level 9
I've updated the sample workflow at:

http://www.avoka.com/samples/EmailReceiver/

Please try this one.

Apologies for the confusion.



FYI, the problem with the original workflow is that the SetValue qpac does not support implicitly converting a string variable to a form variable. Hence the coercion exception.

The fix on the EmailReceiver is to implement this functionality into the EmailReceiver - i.e. The email receiver now allows you to save an attachment (must be an XDP file) directly into a form variable.



Howard

Avatar

Former Community Member
Hi Howard,

great! Thank you for updating your example.



Unfortunately, I get an error in step 7 (# Go to http://localhost:8080/Services, and invoke the ReceiveEmailFromExternalForm workflow.), which simply reads

> 'Service Not Found'



No information is provided in the server log file.



Do you have any idea, how to properly start the workflow as a service?

I also tried to init your example using an e-mail. Which does init the workflow, but apparently does not populate the form with the data sent in via the second e-mail: in Form Manager, the form then is empty.

Avatar

Level 9
Hi

Firstly, make sure you change the sample workflow to use your own email server, username and password. Then...



To start a workflow as a service, you need to do two things:

1. Click on the "Web Service Access" checkbox in the Workflow properties (right click on the workflow, and select Workflow Properties).

2. Start the JBoss server with services enabled, as follows:

In order to enable the /services (web-services) web application, you need to add the following line to the run.bat that starts JBoss. (Find this in the jboss/bin directory.)



-Dadobe.workflow.service.test.enabled=true



In the file, search for the -D line, and append this. i.e.

set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME% -Dadobe.workflow.service.test.enabled=true

You'll need to run jboss from the run.bat file instead of as a service (stop the NT service first)



To do this for JBoss running as an NT service, you need to tweak the registry.

HKEY_LOCAL_MACHINE\SYSTEM\ControlSetxxx\Services\JBoss for Adobe LiveCycle\Parameters

New String Value: JVM Option Number 4: -Dadobe.workflow.service.test.enabled=true

JVM Option Count: Increment to 5



Good luck...

Howard

Avatar

Former Community Member
Yes, I already figured out, how to set Java system parameters. ;-) Also, in the workflow I checked "web service access" and the e-mail server is configured properly.

Does the workflow on our machine not running as intended has anything to do with the e-mail receiver QPAC testing-tab not recognizing attachments at all?

Avatar

Former Community Member
OMG, IT WORKS!!! Yeeeha! :-)



Thank you VERY much for your kind assistance, Howard!



I fiddled about the excellent
variable logger QPAC, which revealed that the form-variable never got populated using the e-mail attachment. Apparently, the mail server in use stripped the attachments, I sent in.

I switched to a different mail server and it finally works. Even the testing-tab in the e-mail receiver tab now works! I'll further investigate, why our e-mail server was wreaking havoc and keep you informed, what went wrong. I suspect an avid virus scanner of deleting the attachments.



Regards,

Steve

Avatar

Former Community Member
Still, I'm interested in getting the workflow run as a web service. Has anyone got this working?

Avatar

Former Community Member
In case anyone is interested:

there's a follow-up thread


EmailReceiver QPAC doesn't retrieve 'content-disposition: inline' attachments



Also, apparently Workflows containing an init-form-variable cannot be instantiated as a web service. Unfortunately.



Steve

Avatar

Level 9
Hi

One simple workaround to your init-form-problems.

Create a simple workflow, with only one step - a Chain. The Chain can invoke the real workflow, passing a blank for as a parameter. You invoke the dummy workflow from your webservice, and because it doesn't have an in-parameter, you have no problems.

Howard

Avatar

Former Community Member
hi folks,



in a dyn. form i have a e-mail button. After clicking you get an attachment. This attachment name will be create randomized, but i want to set the attachment name myself.



Can anyone tell me how to modify the attachment name or set it d

dynamically?



Thanks in adv!



Djinges

Avatar

Level 9
Hi

I don't believe it is possible to control the filename. Sorry.

However, you've posted this in the wrong forum - you may get a better answer if you post in LiveCycle Designer.

Howard

http://www.avoka.com