How to attach a file to a job in Workflow manager

1903
5
05-16-2011 12:24 AM
EvgeniaKaradjova
New Contributor
Hi to all,

Is the tool of WFM which attach a file to a job working correctly? Or is that tool need some additional adjustment?

This question occured when I tried to attach a file to a selected job, but the job was not successfully added in my database. WFM didn't show a message about this. When I checked the source code in debug time I noticed that the workflow of my Flash Builder passed through that lines of code which indicate that the file is successfully uploaded, but unfortunately neighter WFM neighter my ARC Catalog reflects that fact. Actually only the name of the file exists in ArcCatalog and all other fields of the same row in the table JTX_JOB_ATTACHMENTS are empty. WFM still points that there are no attachments to that job in spite of the fact that I just added an attachment.

In source code:
/*
             .........
                file.addEventListener(Event.COMPLETE, onLoadComplete);
         file.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
                file.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onLoadError);
         file.load();
             .........
*/

so here file.data is null, but onLoadComplete handler is activated.

I need some help !

Thanks !
0 Kudos
5 Replies
BrianDemers
Esri Contributor
Hi,

It might be worth trying to add an attachment directly through the REST endpoint using a web browser; that could help narrow down whether there's an issue with the Flash application or with your WMX Server configuration.

The REST API documentation will be installed on the machine where WMX Server has been installed, and should be accessible by going to "Start | All Programs | ArcGIS Workflow Manager | Developer Help | Workflow Manager Server REST Services Help".  From there, you can find the complete details about how to add an attachment using the REST interface.

For convenience, I attached an example from the help is below (...I also added an extra space after the "http:" to keep the forums from hiding the full link):

[INDENT]
Example 1: URL for adding a linked attachment to job ID 5 in the "Workflow" service on sampleserver.

http: //sampleserver/arcgis/rest/services/Workflow/WMServer/jobs/5/attachments/add?user=cjones&storageType=1&filePath=C:\Documents\Job_Guidelines.pdf[/INDENT]

You may also want to use a tool like Fiddler or Firebug to see what URL the web application is using to add the attachment (and to ensure that the application is even getting that far).

I hope that helps; good luck...

Brian D.
0 Kudos
EvgeniaKaradjova
New Contributor
Hi,

When I try to read from JTX an existing attachment which is created by ArcGISDesktop, the attachment is showed in WFM, but it is a linked attachment. I tried to make a linked attachment throught WFM and it seems that it works. Can you show me an example with an embedded attachment. The code is passing through lines that indicate "Upload was successful" and JSONEncoder returns object with an attachmendId, but when I try to load attachments of the selected job, WFM returns empty array (but not null). Toward API Documentation that you explained it seems that everything is ok.
0 Kudos
BrianDemers
Esri Contributor
One thing to look at might be the sample WMX Flex viewer available on the resource center (see here).  The source code is included in the download, and there are a handful of source files that seem to be related to uploading and managing attachments.

Additionally, there's a link to one deployed instance of this viewer (click on the "Related Link" on the page above), and it seems to support embedded attachments.  If the sample viewer is behaving the way you'd like, maybe it will be some help...?
0 Kudos
EvgeniaKaradjova
New Contributor
Ok thanks for your help at all!

There is an observation on the JTX database. When I attach a file by WFM actually the file is properly uploaded and is in the database, but in JOB_ATTACHMENTS table there is a field named OBJECT_GUID and this field is empty (null) when I add a random value to this field by ArcMap then WFM shows the previously attached file. So all I need is to understand how to give a value to the OBJECT_GUID field, where indicate that field (I mean to what other table) and why it is null when I use WFM. Actually it is enough OBJECT_GUID not to be null, then irrelevant to its value (but null) the correct file is showed in WFM.

So I need a little help to the end point.
Thanks !
0 Kudos
TopeBello
Occasional Contributor III
Hi,

This issue has been resolved with the patch posted at this location -
http://resources.arcgis.com/content/patches-and-service-packs?fa=viewPatch&PID=166&MetaID=1772

Please follow the instruction for extracting and installing the patch.

Thanks,
Tope
0 Kudos