Question

HTTP Caller add image from AGOL to Cityworks Work Order

  • 26 February 2024
  • 9 replies
  • 52 views

Badge +2

 Hi all, 

I seem to be getting a strange error when trying to attach an image from a feature layer in AGOL to Cityworks using the HTTP caller. My goal is to download and upload each unique image from the AGOL feature layer and attach it to the correct Work Order (i.e. picture of stop sign for sign work order, picture of a pothole for a pothole worker). My workflows is as follows, read in the AGOL feature layer, save each image using the AttributeFileWritter, create the work order, attach the image using the HTTP Caller. The error occurs when I try to upload the image will using a variable name in the output PATH + .jpeg extension. When I explicitly set the image in the file upload, it runs no problem. However when I use the variable name in the path I get a “ HTTPCaller_2 (HTTPFactory): [11]: HTTP transfer error: HTTP/FTP Transfer: Failed to open file 'C:\Path\To\Documents\WorkOrder_Pictures\.jpeg' for resource upload”. 

 

Here is my Cityworks API call

I write the image to a folder using a unique name 

 

When I set the location of the file to be uploaded in the HTTP caller to the PATH plus variable name I get this error “TTPCaller_2 (HTTPFactory): [11]: HTTP transfer error: HTTP/FTP Transfer: Failed to open file 'C:\Path\To\Documents\WorkOrder_Pictures\.jpeg' for resource upload”

However when I explicitly set the location of the file that includes the file itself, it runs without issues.

 

Unfortunately I cannot upload the same image over and over again and would like to upload a unique image that is being downloaded from the AGOL layer. I have tried to force the PATH by creating a new attribute with the name of the file + extension and that still produced the same error. I have also tried writing temporary files with no luck either. I am aware of a similar post made 1 year ago but the solution did not work for me. 

 

Wondering if anyone has had a similar experince. 


9 replies

Badge +39

What happens if you create the complete path as an attribute in an AttributeCreator before the HttpCaller and select that attribute as input in the HttpCaller? Because it looks like the concat does not work well in the HttpCaller as the log returns:

HTTP/FTP Transfer: Failed to open file 'C:\Path\To\Documents\WorkOrder_Pictures\.jpeg' for resource upload'
 

I believe there is something with @ values in multipart forms that act… special, but I can not remember how I solved it and this probably works just fine.

Badge +2

That was my thought too! I tried making a full file name + PATH +extension and it still produces the same error. 

“HTTPCaller_2 (HTTPFactory): [9]: HTTP transfer error: HTTP/FTP Transfer: Failed to open file '' for resource upload”

Just a very strange behaviour .
 

Badge +39

Does the log still say 

Failed to open file 'C:\Path\To\Documents\WorkOrder_Pictures\.jpeg' for resource upload”

Without the filename? Does the string concatenation work well when checking the feature from the AttributeCreator?

Just to be sure this is not a Feature Caching issue, does it work when you turn it (Feature Caching) off?

Badge +2

I have attached a screengrab from the log. It says the same message. I have also turned off Feature Caching and still producing this error

The full path names with extensions are also being correctly written in the AttributeCreator

 

Badge +39

I have a workspace in production where a thumpnail is being uploaded to an API. In that workspace, I also set the MIME type using an attribute:

 

Badge +2

Hi @nielsgerrits 

Thanks for your reply!

I tried to create a seperate attribute with the MIME type value using AttributeCreator and that still do not work for me. 

Can I ask you what version of FME form you are running? I am winderng if I am using an outdated version. This is my version FME form 2023.0.2.1 (20230803 - Build 23339 - WIN64). 

 

 

Badge +39

Hi @nielsgerrits 

Thanks for your reply!

I tried to create a seperate attribute with the MIME type value using AttributeCreator and that still do not work for me. 

Can I ask you what version of FME form you are running? I am winderng if I am using an outdated version. This is my version FME form 2023.0.2.1 (20230803 - Build 23339 - WIN64). 

 

 

You can always check with a different version to be sure, but I’m running 2021.2.6.

Badge +39

@afrancio you are not the only one struggling:

 

Badge +2

@nielsgerrits 

Well that is good to know at least! 

I saw this post earlier as well and tried to set the source dataset as well. However when I feed it my path with dyanamic variable.. it produces the same result as before. 

 

Reply