Zum Hauptinhalt gehen

How to use a file path as a parameter for "send web request" activity in vertiGIS Workflow

Kommentare

6 Kommentare

  • Jamal Numan

    +1

    2
  • Nico Burgerhart

    Jamal Numan You can use the Up arrow on the right to upvote posts.

    4
  • Ryan Cooney

    Send Web Request is not able to use file paths. However, since this is a server workflow you can use the Read File activity to do that. 

    If the file contents is JSON, then you can follow it with the Parse JSON activity.

    3
  • Lubna

    Dear Ryan Cooney

    Thank you for your reply,

    What I want is to read the attached file by the end user (.dwg) from the client workflow and read it as an input in the server workflow to run "send we service" activity because there is a uri need to be run as below:

    1. take the (.dwg file) as input

    2. convert .dwg to json file

    But as you mentioned above that the "send web request" activity will not take the path of file as input, so there is no need to write or read the file in the server, that's right?

    If yes, that mean I need to put the byte out put of the attached file to be the input of the send web request?

    where I can put it in the query or in the form?

    Any help will be very appreciated :)

    The below screenshots client workflow and the server workflow:

     

     

     

    Code of Client workflow:

    {"_properties":{"isServerWorkflow":false},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"0,20","purpose":"start","title":"Start","transitions":[{"id":6,"inputs":{},"position":"90,80 90,140","sourceConnector":"bottom","target":{"id":4}}]},{"action":"gcx:wf:forms:form:DisplayForm","id":4,"inputs":{"form":{"accessors":[],"code":"resources.forms[values.id]","values":{"id":5}}},"name":"form1","position":"-30,140","title":"Display Form","transitions":[{"id":12,"inputs":{},"position":"90,260 90,320","sourceConnector":"bottom","target":{"id":11}}]},{"action":"gcx:wf:core::GetBase64StringFromFile","id":11,"inputs":{"file":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.filePicker1.value.files[0]","source":"$form1.state.filePicker1.value.files[0]"}},"name":"getBase64","position":"-30,320","title":"Get Base64 String From File","transitions":[{"id":22,"position":"90,390 90,460","sourceConnector":"bottom","target":{"id":58}}]},{"action":"gcx:wf:core::RunWorkflow","id":58,"inputs":{"arguments":{"accessors":["$getBase64","$form1"],"annotations":[{"count":10,"index":27,"kind":"idref"},{"count":6,"index":55,"kind":"idref"}],"code":"{ base64FromClientWorkflow: $getBase64.result,\n    fileName: $form1.state.filePicker1.value.files[0].name }","source":"{base64FromClientWorkflow: $getBase64.result,\nfileName:$form1.state.filePicker1.value.files[0].name}"},"url":"https://lubnaj-pc.molg.pna.ps/adaptor/home/item.html?id=7b20acfe3ab84015b9d59fb738fff873"},"name":"runWorkflow1","position":"-30,460","title":"Run Workflow"}]}],"designerVersion":"5.30.1+1","forms":[{"defaults":{},"elements":{"filePicker1":{"enabled":true,"fileTypes":"*","index":0,"prompt":{"markdown":"Add File"},"rowIndex":0,"rowNumber":0,"size":1,"title":{"markdown":"File Picker"},"type":"FilePicker"},"footer":{"enabled":true,"items":{"0":{"default":true,"index":0,"label":{"markdown":"Submit"},"validates":true,"value":"submit"},"1":{"index":1,"label":{"markdown":"Cancel"},"validates":false,"value":"cancel"}},"section":"footer","type":"ButtonBar"},"header":{"section":"header","title":{"markdown":"Form Title"},"type":"Header"}},"id":5}],"licenseInfo":{"licenseUrl":"https://lubnaj-pc.molg.pna.ps/vertigisstudio/workflow/service/auth/license"},"start":{"id":3}}

     

    Code of server workflow:

    {"_properties":{"isServerWorkflow":true},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"150,-100","purpose":"start","title":"Start","transitions":[{"id":16,"position":"240,-40 240,30","sourceConnector":"bottom","target":{"id":8},"targetConnector":"top"}]},{"action":"gcx:wf:server::WriteFileBytes","id":6,"inputs":{"bytes":{"accessors":["$getBytesFromBase64String1"],"annotations":[{"count":26,"index":0,"kind":"idref"}],"code":"$getBytesFromBase64String1.result","source":"$getBytesFromBase64String1.result"},"path":{"accessors":["Date","$getWorkflowInputs1"],"annotations":[{"count":4,"index":46,"kind":"idref"},{"count":19,"index":58,"kind":"idref"}],"code":"\"C:/ProgramData/Geocortex/Workflow/fme/xxx/\" + Date.now() + $getWorkflowInputs1.inputs.fileName","source":"\"C:/ProgramData/Geocortex/Workflow/fme/xxx/\" +Date.now() +$getWorkflowInputs1.inputs.fileName"}},"position":"120,340","title":"Write File Bytes"},{"action":"gcx:wf:core::GetWorkflowInputs","id":8,"inputs":{},"name":"getWorkflowInputs1","position":"120,30","title":"Get Workflow Inputs","transitions":[{"id":25,"inputs":{},"position":"240,100 240,140","sourceConnector":"bottom","target":{"id":11},"targetConnector":"top"}]},{"action":"gcx:wf:core::GetBytesFromBase64String","id":11,"inputs":{"base64":{"accessors":["$getWorkflowInputs1"],"annotations":[{"count":19,"index":0,"kind":"idref"}],"code":"$getWorkflowInputs1.inputs.base64FromClientWorkflow","source":"$getWorkflowInputs1.inputs.base64FromClientWorkflow"}},"name":"getBytesFromBase64String1","position":"120,140","title":"Get Bytes From Base64 String","transitions":[{"id":19,"position":"240,210 240,240 380,240 380,410 240,410 240,430","sourceConnector":"bottom","target":{"id":18},"targetConnector":"top"}]},{"action":"gcx:wf:core:request:WebRequest","id":18,"inputs":{"expect":"json","headers":{"accessors":[],"annotations":[],"code":"{ \"Header\": \"headers\",\n    \"Content-Type\": \"Application/json\" }","source":"{\"Header\": \"headers\",\n\"Content-Type\": \"Application/json\"}"},"method":"POST","query":{"accessors":["$getBytesFromBase64String1"],"annotations":[{"count":26,"index":0,"kind":"idref"}],"code":"$getBytesFromBase64String1.result","source":"$getBytesFromBase64String1.result"},"timeout":1000,"url":"http://10.111.60.100/fmedatastreaming/Samples/CAD_To_GIS.fmw?"},"name":"webRequest1","position":"120,430","title":"Send Web Request"},{"action":"gcx:wf:server::CreateDirectory","id":22,"inputs":{"path":{"accessors":["Date"],"annotations":[{"count":4,"index":46,"kind":"idref"}],"code":"\"C:/ProgramData/Geocortex/Workflow/fme/xxx/\" + Date.now()","source":"\"C:/ProgramData/Geocortex/Workflow/fme/xxx/\" +Date.now()"}},"position":"120,260","title":"Create Directory"}]}],"designerVersion":"5.30.1+1","licenseInfo":{"licenseUrl":"https://lubnaj-pc.molg.pna.ps/vertigisstudio/workflow/service/auth/license"},"start":{"id":3}}

     

    The returned error is the below when run the client workflow in the sandbox:

     

    Best,

    Lubna

     

    1
  • Lubna

    Hi All,

    I still have an issue in the send web request which has a variable input file .dwg  from the end user which I can't read it as a text but a .dwg as an input for this request, how can I read it from it with the extension ".dwg"

     

    Best,

    Lubna

    1
  • Lubna

    Here are the enhanced workflows which are worked fine with me but it overwrites the file in the server since I make the server AutoCAD file to be P.dwg which is a parameter of the published workbench

    I will be very appreciated if anyone can help me in the below small partition which is:

    To put the RESULT OF THE READ FILE activity in SEND WEB REQUEST, I need it  in case I have multiple users attach .dwg file in the same time (same minute) which will make different output graphic to one of the two users,

    I still can’t use the read file output in the send web request

     

    The below workflows that are running well:

    server workflow:

    {"_properties":{"isServerWorkflow":true},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"-420,-200","purpose":"start","title":"Start","transitions":[{"id":21,"inputs":{},"position":"-330,-140 -330,65 120,65","sourceConnector":"bottom","target":{"id":8}}]},{"action":"gcx:wf:server::WriteFileBytes","id":6,"inputs":{"bytes":{"accessors":["$getBytesFromBase64String1"],"annotations":[{"count":26,"index":0,"kind":"idref"}],"code":"$getBytesFromBase64String1.result","source":"$getBytesFromBase64String1.result"},"path":{"accessors":[],"annotations":[],"code":"\"//10.111.60.100/fme/\" + \"P.dwg\"","source":"\"//10.111.60.100/fme/\"+\"P.dwg\""}},"position":"120,290","title":"Write File Bytes","transitions":[{"id":15,"position":"240,320 240,340 -190,340 -190,210 -330,210 -330,230","sourceConnector":"bottom","target":{"id":46},"targetConnector":"top"}]},{"action":"gcx:wf:core::GetWorkflowInputs","id":8,"inputs":{},"name":"getWorkflowInputs1","position":"120,30","title":"Get Workflow Inputs","transitions":[{"id":25,"inputs":{},"position":"240,100 240,140","sourceConnector":"bottom","target":{"id":11},"targetConnector":"top"}]},{"action":"gcx:wf:core::GetBytesFromBase64String","id":11,"inputs":{"base64":{"accessors":["$getWorkflowInputs1"],"annotations":[{"count":19,"index":0,"kind":"idref"}],"code":"$getWorkflowInputs1.inputs.base64FromClientWorkflow","source":"$getWorkflowInputs1.inputs.base64FromClientWorkflow"}},"name":"getBytesFromBase64String1","position":"120,140","title":"Get Bytes From Base64 String","transitions":[{"id":30,"inputs":{},"position":"240,210 240,290","sourceConnector":"bottom","target":{"id":6},"targetConnector":"top"}]},{"action":"gcx:wf:core:request:WebRequest","id":46,"inputs":{"url":"http://10.111.60.100/fmedatastreaming/Samples/CAD_To_GIS.fmw?"},"name":"webRequest1","position":"-450,230","title":"Send Web Request","transitions":[{"id":49,"inputs":{},"position":"-330,300 -330,420 -340,420 -340,440","sourceConnector":"bottom","target":{"id":48}}]},{"action":"gcx:wf:core::SetWorkflowOutput","id":48,"inputs":{"name":"v","value":{"accessors":["$webRequest1"],"annotations":[{"count":12,"index":0,"kind":"idref"}],"code":"$webRequest1.text","source":"$webRequest1.text"}},"position":"-460,440","title":"Set Workflow Output"}]}],"designerVersion":"5.30.1+1","licenseInfo":{"licenseUrl":"https://lubnaj-pc.molg.pna.ps/vertigisstudio/workflow/service/auth/license"},"start":{"id":3}}

    Client Workflow:

    {"_properties":{"isServerWorkflow":false},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"-70,-110","purpose":"start","title":"Start","transitions":[{"id":47,"inputs":{},"position":"20,-50 20,50 0,50 0,70","sourceConnector":"bottom","target":{"id":4},"targetConnector":"top"}]},{"action":"gcx:wf:forms:form:DisplayForm","id":4,"inputs":{"form":{"accessors":[],"code":"resources.forms[values.id]","values":{"id":5}}},"name":"form1","position":"-120,70","title":"Display Form","transitions":[{"id":89,"position":"0,190 0,240 -10,240 -10,260","sourceConnector":"bottom","target":{"id":11}}]},{"action":"gcx:wf:core::GetBase64StringFromFile","id":11,"inputs":{"file":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.filePicker1.value.files[0]","source":"$form1.state.filePicker1.value.files[0]"}},"name":"getBase64","position":"-130,260","title":"Get Base64 String From File","transitions":[{"id":77,"position":"-10,330 -10,370 0,370 0,390","sourceConnector":"bottom","target":{"id":58},"targetConnector":"top"}]},{"action":"gcx:wf:core::ParseJson","id":41,"inputs":{"json":{"accessors":["$runWorkflow1"],"annotations":[{"count":13,"index":0,"kind":"idref"}],"code":"$runWorkflow1.result.v","source":"$runWorkflow1.result.v"}},"name":"parseJson1","position":"-110,530","title":"Parse JSON","transitions":[{"id":81,"position":"10,600 10,670 0,670 0,690","sourceConnector":"bottom","target":{"id":80}}]},{"action":"gcx:wf:arcgis::FeatureSetFromJson","id":50,"inputs":{"json":{"accessors":["$parseJson1"],"annotations":[{"count":11,"index":0,"kind":"idref"}],"code":"$parseJson1.result.RecordSet","source":"$parseJson1.result.RecordSet"}},"name":"featureSet1","position":"-470,780","title":"Get Feature Set From JSON","transitions":[{"id":55,"position":"-350,850 -350,1005 -380,1005","sourceConnector":"bottom","target":{"id":54}}]},{"action":"gcx:wf:arcgis::SymbolFromJson","id":54,"inputs":{"json":"{\n    \"type\": \"esriSLS\",\n    \"style\": \"esriSLSDot\",\n    \"color\": [115,76,0,255],\n    \"width\": 2\n  }"},"name":"symbol1","position":"-620,970","title":"Get Symbol From JSON","transitions":[{"id":60,"position":"-500,1040 -500,1140","sourceConnector":"bottom","target":{"id":59}}]},{"action":"gcx:wf:core::RunWorkflow","id":58,"inputs":{"arguments":{"accessors":["$getBase64","$form1"],"annotations":[{"count":10,"index":27,"kind":"idref"},{"count":6,"index":55,"kind":"idref"}],"code":"{ base64FromClientWorkflow: $getBase64.result,\n    fileName: $form1.state.filePicker1.value.files[0].name }","source":"{base64FromClientWorkflow: $getBase64.result,\nfileName:$form1.state.filePicker1.value.files[0].name}"},"url":"https://lubnaj-pc.molg.pna.ps/adaptor/home/item.html?id=7b20acfe3ab84015b9d59fb738fff873"},"name":"runWorkflow1","position":"-120,390","title":"Run Workflow","transitions":[{"id":42,"position":"0,460 0,510 10,510 10,530","sourceConnector":"bottom","target":{"id":41},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis::CreateFeatureSet","id":59,"inputs":{"features":{"accessors":["$featureSet1"],"annotations":[{"count":12,"index":0,"kind":"idref"}],"code":"$featureSet1.featureSet.features","source":"$featureSet1.featureSet.features"},"geometries":{"accessors":["$parseJson1"],"annotations":[{"count":11,"index":0,"kind":"idref"}],"code":"$parseJson1.result.RecordSet.features.geometry","source":"$parseJson1.result.RecordSet.features.geometry"}},"name":"featureSet2","position":"-620,1140","title":"Create Feature Set","transitions":[{"id":64,"position":"-500,1210 -500,1310 -400,1310 -400,1330","sourceConnector":"bottom","target":{"id":63},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis::SetFeatureSymbol","id":63,"inputs":{"feature":{"accessors":["$featureSet2"],"annotations":[{"count":12,"index":0,"kind":"idref"}],"code":"$featureSet2.featureSet","source":"$featureSet2.featureSet"},"symbol":{"accessors":["$symbol1"],"annotations":[{"count":8,"index":0,"kind":"idref"}],"code":"$symbol1.symbol","source":"$symbol1.symbol"}},"position":"-520,1330","title":"Set Feature Symbol","transitions":[{"id":68,"position":"-400,1360 -400,1450 -300,1450 -300,1470","sourceConnector":"bottom","target":{"id":67},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis::AddGraphicsLayerFeatures","id":67,"inputs":{"features":{"accessors":["$featureSet2"],"annotations":[{"count":12,"index":0,"kind":"idref"}],"code":"$featureSet2.featureSet.features","source":"$featureSet2.featureSet.features"},"layerId":"cad","removeAllFeatures":true},"name":"addGraphics1","position":"-420,1470","title":"Add Graphics","transitions":[{"id":72,"position":"-300,1540 -300,1570 -310,1570 -310,1590","sourceConnector":"bottom","target":{"id":71},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis::GetFeatureSetExtent","id":71,"inputs":{"features":{"accessors":["$featureSet2"],"annotations":[{"count":12,"index":0,"kind":"idref"}],"code":"$featureSet2.featureSet.features","source":"$featureSet2.featureSet.features"}},"name":"getFeatureSetExtent1","position":"-430,1590","title":"Get Feature Set Extent","transitions":[{"id":76,"position":"-310,1660 -310,1710 -270,1710 -270,1730","sourceConnector":"bottom","target":{"id":75},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis::SetViewExtent","id":75,"inputs":{"features":{"accessors":["$featureSet2"],"annotations":[{"count":12,"index":0,"kind":"idref"}],"code":"$featureSet2.featureSet.features","source":"$featureSet2.featureSet.features"},"geometry":{"accessors":["$getFeatureSetExtent1"],"annotations":[{"count":21,"index":0,"kind":"idref"}],"code":"$getFeatureSetExtent1.center","source":"$getFeatureSetExtent1.center"}},"name":"setMapExtent16","position":"-390,1730","title":"Set Map Extent"},{"action":"gcx:wf:core::If","description":"Polyline","id":80,"inputs":{"condition":{"accessors":["$parseJson1"],"annotations":[{"count":11,"index":0,"kind":"idref"}],"code":"$parseJson1.result.RecordSet.geometryType == \"esriGeometryPolyline\"","source":"$parseJson1.result.RecordSet.geometryType==\"esriGeometryPolyline\""}},"position":"-120,690","title":"If","transitions":[{"branch":"true","id":82,"position":"-120,735 -350,735 -350,780","sourceConnector":"left","target":{"id":50},"targetConnector":"top"},{"branch":"false","id":84,"position":"120,735 340,735 340,820","sourceConnector":"right","target":{"id":83},"targetConnector":"top"}]},{"action":"gcx:wf:ui::Alert","id":83,"inputs":{"text":"\"الرجاء التأكد من ان ملف الاوتوكاد يحتوي على خطوط\"","title":"تنبيه"},"position":"220,820","title":"Alert"}]}],"designerVersion":"5.30.1+1","forms":[{"defaults":{},"elements":{"filePicker1":{"enabled":true,"fileTypes":"*","index":0,"prompt":{"markdown":"Add File"},"rowIndex":0,"rowNumber":0,"size":1,"title":{"markdown":"Add an AutoCAD File  |  اضافة ملف اوتوكاد"},"type":"FilePicker"},"footer":{"enabled":true,"items":{"0":{"default":true,"index":0,"label":{"markdown":"Ok"},"validates":true,"value":"Ok"},"1":{"index":1,"label":{"markdown":"Cancel"},"validates":false,"value":"cancel"}},"section":"footer","type":"ButtonBar"},"header":{"section":"header","title":{"markdown":"Form Title"},"type":"Header"}},"id":5}],"licenseInfo":{"licenseUrl":"https://lubnaj-pc.molg.pna.ps/vertigisstudio/workflow/service/auth/license"},"start":{"id":3}}

     

    Best,

    Lubna

     

    1

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.