0 Replies Latest reply on Nov 23, 2016 5:24 AM by kbutz RSS
    kbutz Newbie

    Edge Microserver - File Transfer

    Hi,

     

    I'd like to transfer a file using the Edge Microserver. Did the steps in the manual, but its not working for me - unforunately i don't know why or how to find out whats the problem now.

     

    Did the following steps:

    1) started Microserver with the below config file:

    {

      "ws_servers": [{

      "host": "xxx.xx.xx.xx",

      "port": 8080

      }],

      "ws_connection": {

      "encryption": "none"

      },

      "appKey": "xxx",

      "file": {

      "buffer_size": 8192,

      "max_file_size": 8000000000,

      "virtual_dirs":[

      { "In" : "C:\Dev\Tools\TWX Edge Microserver\microserver\in" },

      { “Out": "C:\Dev\Tools\TWX Edge Microserver\microserver\out" },

      { "staging": "C:\Dev\Tools\TWX Edge Microserver\microserver\staging" }

      ],

      "staging_dir": "staging"

      }

     

    }

     

    --> Server is connected and working, specified directories are existing of course.

     

    2) Created /files directory on the Thingworx Server and placed abc.txt into (/root/ThingworxStorage/repository/SystemRepository/files/abc.txt)
    3) Created RemoteThingWithFileTransfer named "RT1" in Thingworx
    4) Created Pyhton Script to trigger Webservice with the following JSON Content:

    - sourceRepo: SystemRepository
    - sourcePath: /files
    - sourceFile: abc.txt
    - targetRepo: RT1
    - targetPath: /In
    - targetFile: abc.txt

     

     

    The complete python script:

    #!/usr/bin/python

    import requests

    import sys

    import json

     

    appKey = 'xxx'

    jsonString = '{\"sourceRepo\": \"SystemRepository\", \"sourcePath\": \"/files\", \"sourceFile\": \"abc.txt\", \"targetRepo\": \"RT1\", \"targetPath\": \"/In\", \"targetFile\": \"abc.txt\"}'

    payload = json.loads(jsonString)


    headers = { 'Content-Type': 'application/json', 'appKey': appKey }

    response = requests.put('http://localhost:8000/ThingWorx/Subsystems/FileTransferSubsystem/Services/Copy', headers=headers, json=payload, verify=False)

     

    As you see I'm using the localhost (microserver running on the same pc). It's not working and I'm having serious problems to find the problem? Does anyone see what I've missed or did wrong?

     

    Many Thanks in Advance!