span8
span4
span8
span4
Goal
I want to use FME-server as endpoint for sensordata (senML). This sensordata is posted from the sensors to our server with JSON as body.
Situation
I created a workspace which is comparable with the posts as described in these posts and everyting related to this
The last URL also contains my question from earlier today, but I got advised to create a new topic.
In short my workspace contains:
The workspace works perfectly when running from my computer with FME workbench.
I uploaded the workspace to FME-server, using the jobsubmitter as service and in the settings of the service I pointed to the reader (Send HTTP Message Body to Reader)
textline2postgis-shared-version.fmw
Problem/testing
I'm using Postman to test posting the data. My http post contains the required headers and token certification, so this is no issue. In my FME-server job I can see that it is trying to run the job. But when checking the logfile, I get the following error:
Text File Reader: Source dataset 'P:\Projecten\Nijmegen\Nijmegen BMON Ontzorging VSMS 301474\4. FME\SampleJson.txt' does not exist
Posted data (body which is an exact copy of the contents of my textfile-reader)
{ "type": "SenMLPackPayload", "senMLPack": [ { "bn": "urn:dev:com.sensoterra:18000167260", "bt": 1532089461 }, { "n": "soilmoisture", "u": "%vol", "v": 11.4, "depth": 15 } ] }
Conclusion/Question
So, to conclude; although I think I followed all the steps, FME-server still tries to read the original file-data instead of the body/content of the HTML POST.
Is there anyone who know why this is happening?
Some extra information:
Hello Koen,
Thank you for your post to the community. I was able to get it to work and I'm hoping that this is the solution you are looking for.
1) I opened up your workspace and ensured that the reader parameter was optional. To do this select SourceDataset_TEXTLINE, then click Edit Value, and then select optional.
2) I added a logger to ensure that the correct data was written in.
3) I uploaded your workspace to the FME Server, using the Job Submitter Service and setting the properties send HTTP Message Body to Reader: SampleJson [TEXTLINE].
4) I went to the FME Server to find the DirectURL for the workspace. To do this go to the Workspace on the FME Server, open the advanced parameters, and find the Direct URL. 2018-07-20-15-20-30.png
5) I set the security settings to allow guests to access my repository. To do this in the security panel of the FME Server, click on users, find guest and double-click to access the settings. 2018-07-20-15-23-26.png Once you are on the guest page, find permissions, find the repository you uploaded to and give guest the permissions to run. 2018-07-20-15-27-26.png
6) Copy the DirectURL into Postman and select the POST method. 2018-07-20-15-28-56.png
Then, click the body section and add in your JSON. 2018-07-20-15-30-01.png
7) Click Send and review!! You should see the data was uploaded to the Server. If you check the job log you should see this worked. 2018-07-20-15-31-45.png
Hopefully, this solution works for you. If not please send me the call you were trying to use.
Also, in two weeks we have a full course on the REST API if you are interested. https://www.safe.com/training/registration/7010c000002WjbFAAS/
https://blog.safe.com/2018/06/new-fme-training-course-build-web-application-rest-api/
Make sure that the URL syntax is correct as a request of Job Submitter Service in Transformation Services - FME Server Web Services.
I'm afraid that you are going to submit the job via FME Server REST API. Just be aware that the URL syntax of Transformation Services is different from REST API.
I generally just have a text parameter called JSONObject, and use a Creator-> ParameterFetcher ->JSON Transformation rather than a reader.
Caveats:
In some versions of FME there is a difference in behaviour in regards to escape characters and accessing the JSON parameter directly vs fetching it and accessing it via the resultant attribute.
In some versions of FME there is a difference in behaviour in regards to backslashes between parameter types Text and Text Multiline
How to add jobid in REST DataDownload or including {downloadUrl} in mail with submit 2 Answers
I’m doing an FME Server backup that fails when I try to download it, why? 1 Answer
Failed to bind to Active Directory 6 Answers
Add zip file size to data download notication email 2 Answers
get FME server user information from REST end point? 2 Answers
© 2019 Safe Software Inc | Legal