Skip to main content

FME activity pack

Comments

7 comments

  • Berend Veldkamp

    I don't think .value.files[0] will send the actual file contents to FME. 

    You could try to use the Get Base64 String From File activity, and pass the resulting string as input to FME. FME would then need to decode the base64 string, and go from there.

    In addition, you would probably need to send .value.files[0].type and/or .value.files[0].name to FME, so it can guess the file format.

    1
  • Niels Gerrits

    What Berend describes (submit a job with a Base64 string in a published parameter) will probably work, but I have not tried that variant.

    As described in this article
    https://support.safe.com/hc/en-us/articles/25407682233357-Data-Loading-Options-With-FME-Server
    uploading and starting a workspace is a 2 step process.

    I think the "Use FME Service" is the activity to use the data upload service described here
    https://docs.safe.com/fme/html/FME-Flow/ReferenceManual/service_dataupload.htm

    We do this a bit different. We use a client side workflow to send the Base64 string of the file to a server side workflow which uploads it to a fileshare. When this is done, the workspace is started with the filepath as a published parameter.

    1
  • Berend Veldkamp

    Ah, yes. I'm not an FME expert, so I'd forgotten about the FME data upload service. That would probably be the way to go, especially for larger files. 

    You still need to convert to base64 though, because that's unfortunately the only (inefficient) way to upload a file from a client workflow. Idea 

    0
  • Paal Pedersen

    It can be done as a on post action if you use the FME Rest API.

    We have setup a proxy for FME Flow on the same server.

    Example url:

    =`/fmerest/v3/transformations/transact/${$repo.result}/${$workspace.result}`

    Example body:

    ={
     "publishedParameters": [
       {
         "name": "param1",
         "value":$param1.result
       }
       {
         "name": "blob",
         "value":$getBase64.result
       }
     ]
    }

    then we use activity Send Web Request:

    Inputs

    url

    =$url.result

    header:

    ={
       "Authorization": “fmetoken token=”your token created in fme flow",
       "Content-Type": "application/json"
    }

     

    Json

    =$body.result

     

    We parse response like this:

    =JSON.parse($sendWebRequest.channel.response.content)["status"] == "SUCCESS"

    0
  • Espen Gudevang

    I had (sort of) success with this one:

    I published the FME-workspace with the datastreaming-option, then created a web hook on the published workspace. Then I used that webhook-url and token in the VertiGIS Send Web request. 

    Url:
    https://<our fme flow>/fmedatastreaming/vertigis/vertigis_import9_fme2023.fmw?SourceDataset_base64=&Filtype=&DestDataset_TEXTLINE=vertigis_json.json


    Header:
    ={
      "Authorization": "fmetoken token=<my token>",
      "Content-Type": "application/x-www-form-urlencoded"
    }

    Form:
    ={
    SourceDataset_base64:$getBase64.result,
    Filtype:$filtype.result
    }
     

    The FME workspace is configured with an ESRIjson response, which is easy to parse and process in the workflow.

    In my environment this work for pretty small inputfiles (< 1500kb), but now it seems that the workflow-activity “Get Base64 String From File” have some limitations with file size. Which is another problem :-)
     

    1
  • Espen Gudevang

    Have anyone had any success with the example from Ryan Cooney (in another thread)?

    "I have completed that pull request on the FME activity pack. Even though we can't test your specific use case we are able to confirm that it does do a multipart/form-data request and it doesn't break any existing functionality.

    If you use version 2.1.0 of the activity pack it would look something like this:

    Use FME Service

    • Path: resources/connections/FME_SHAREDRESOURCE_DATA/filesys/SaferSpeed
    • Method: POST
    • Content Type: multipart/form-data
    • Data: ={ file: $form1.state.filePicker1.value.files[0], createDirectories: false, overwrite: false }

    --Ryan"

    0
  • Espen Gudevang

    I found a solution now with the Send Web Request activity, and not the Use FME Service, to upload a file to FME Flow:

    • Url: <your FME Flow>/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_DATA/filesys/vertigis
    • Method: POST
    • Headers: 
      ={
      "Authorization": "fmetoken token=<token-value>",
      "Content-Disposition":"attachment"
      }
    • Form: ={file:$form1.state.filePicker1.value.files[0]}
    0

Please sign in to leave a comment.