Skip to main content

I am trying to push a HTTP Request notification to a client machine using a Text Writer with MIME Mode set to 'application\\json'. The issue we're running into is that we get extra "\\" in the 'subscriber_content' section. It appears that the notification is converting the 'subscriber_content' to a string vs. leaving it in the JSON format.

It should like this:

{"Title":"Test WARS JSON Message","Message":"Simple Message","ActivityCode":[{"ActivityUID":"M336_34687_4592_08000AOH000","ActivityCode":"M336"}]}

However, it is coming thru like this in both FME Sever Topics Monitoring and on the client machine receiving the message:

{ "workspace": "ITD_WARS_JSON_MessageTest.fmw", "timeRequested": "Wed-02-Oct-2019 01:14:55 PM", "ws_topic": "WARS_JSON_Message", "NumFeaturesOutput": "1", "jobsuccess_topic{0}": "WARS_JSON_Message", "requestKeyword": "WORKSPACE_SUBSCRIBER", "timeStarted": "Wed-02-Oct-2019 01:14:55 PM", "repository": "WARS2", "LogFileName": "job_71.log", "StatusMessage": "Translation Successful", "subscriber_content": "{\\"Title\\":\\"Test WARS JSON Message\\",\\"Message\\":\\"Simple Message\\",\\"ActivityCode\\":t{\\"ActivityUID\\":\\"M336_34687_4592_08000AOH000\\",\\"ActivityCode\\":\\"M336\\"}]}\\r\\n", "StatusNumber": "0", "id": "71", "timeFinished": "Wed-02-Oct-2019 01:14:56 PM", "logHome": "", "logUrl": "" }

As you can see, there are extra slashes "\\" in the subscriber_content section of the message. We're also getting strange characters like "" in our message as well.

We're using FME Server 2019.1.2

Any help you could provide would be appreciated. Thanks!

-Mark

What happens if you use an FMEServerNotifier with the json sent as the content, instead of writing it to a text file?


What happens if you use an FMEServerNotifier with the json sent as the content, instead of writing it to a text file?

@jdh I tried the FMEServerNotifier transformer with JSON output and got the same results.


@jdh I tried the FMEServerNotifier transformer with JSON output and got the same results.

The slashes are to escape the the quotes, that means it's not recognizing the subscriber content as JSON.

 

 

Can you try running it through a JSONValidator, to see if it reports any errors?  is a Byte Order Mark, so there is probably some encoding issues going on.

The slashes are to escape the the quotes, that means it's not recognizing the subscriber content as JSON.

 

 

Can you try running it through a JSONValidator, to see if it reports any errors?  is a Byte Order Mark, so there is probably some encoding issues going on.

Everything passed in the JSONValidator. Here's a sample of what I am trying to pass thru as a message:

{"Title":"Test WARS JSON Message","Message":"Simple Message","ActivityCode":u{"ActivityUID":"M336_45684_458_15864IN084","ActivityCode":"M336","RouteID":"15864IN084","RouteName":"I-84","BeginMile":"25.5","EndMile":"33.5","PassMiles":"2"},{"ActivityUID":"M336_45684_458_15847US021","ActivityCode":"M334","RouteID":"15847US021","RouteName":"US 21","BeginMile":"18","EndMile":"35","PassMiles":"1"}]}

 

The extra characters only come after I attempt to pass an 'application\\json' MIME type Text File via a FME Server Automation HTTP Request external action.

Here is the 'subscriber_content' that the client machine is receiving:

\\"subscriber_content\\": \\"{\\\\"Title\\\\":\\\\"Test WARS JSON Message\\\\",\\\\"Message\\\\":\\\\"Simple Message\\\\",\\\\"ActivityCode\\\\":\{\\\\"ActivityUID\\\\":\\\\"M336_45684_458_15864IN084\\\\",\\\\"ActivityCode\\\\":\\\\"M336\\\\",\\\\"RouteID\\\\":\\\\"15864IN084\\\\",\\\\"RouteName\\\\":\\\\"I-84\\\\",\\\\"BeginMile\\\\":\\\\"25.5\\\\",\\\\"EndMile\\\\":\\\\"33.5\\\\",\\\\"PassMiles\\\\":\\\\"2\\\\"},{\\\\"ActivityUID\\\\":\\\\"M336_45684_458_15847US021\\\\",\\\\"ActivityCode\\\\":\\\\"M334\\\\",\\\\"RouteID\\\\":\\\\"15847US021\\\\",\\\\"RouteName\\\\":\\\\"US 21\\\\",\\\\"BeginMile\\\\":\\\\"18\\\\",\\\\"EndMile\\\\":\\\\"35\\\\",\\\\"PassMiles\\\\":\\\\"1\\\\"}]}\\r\\n{\\\\"Title\\\\":\\\\"Test WARS JSON Message\\\\",\\\\"Message\\\\":\\\\"Simple Message\\\\",\\\\"ActivityCode\\\\":\{\\\\"ActivityUID\\\\":\\\\"M336_45684_458_15864IN084\\\\",\\\\"ActivityCode\\\\":\\\\"M336\\\\",\\\\"RouteID\\\\":\\\\"15864IN084\\\\",\\\\"RouteName\\\\":\\\\"I-84\\\\",\\\\"BeginMile\\\\":\\\\"25.5\\\\",\\\\"EndMile\\\\":\\\\"33.5\\\\",\\\\"PassMiles\\\\":\\\\"2\\\\"},{\\\\"ActivityUID\\\\":\\\\"M336_45684_458_15847US021\\\\",\\\\"ActivityCode\\\\":\\\\"M334\\\\",\\\\"RouteID\\\\":\\\\"15847US021\\\\",\\\\"RouteName\\\\":\\\\"US 21\\\\",\\\\"BeginMile\\\\":\\\\"18\\\\",\\\\"EndMile\\\\":\\\\"35\\\\",\\\\"PassMiles\\\\":\\\\"1\\\\"}]}\\r\\n\\",

 


What's the default encoding of the client machine and the machine running the workspace?

 

On the text writer, what is the character encoding set to?

It seems to me that the Byte Order Mark  is being added to your string to specify the character code set, and the notification service is then not recognizing the subscriber_content as valid JSON, so it is then escaping all the characters that actually mean something in JSON.

 


We decided to just use a HTTPCaller inside the workbench vs. using a FME Server Automation Notification. Couldn't resolve this issue and moved on. If anyone at Safe wants to look into this, I can send over log files.


We decided to just use a HTTPCaller inside the workbench vs. using a FME Server Automation Notification. Couldn't resolve this issue and moved on. If anyone at Safe wants to look into this, I can send over log files.

Hi @mmccart,

I'm sorry you ran into this issue, I also see the same behaviour so have filed a bug (internal reference: FMESERVER-13681) requesting this fix. I will update this post once this has been resolved.


Hi @mmccart,

I'm sorry you ran into this issue, I also see the same behaviour so have filed a bug (internal reference: FMESERVER-13681) requesting this fix. I will update this post once this has been resolved.

Hi @mmccart,

We have made a decision not to pursue this issue as our main focus is now on Automations.

After further investigation it appears this is an issue with how topic monitoring is parsing through the incoming topic message, and the message here is going to vary depending on how you are sending it to the topic. Therefore to look at the topic message going forward, I'd instead recommend viewing the raw json file which will present the subscriber_content accurately. This is located in Resources > System > temp > engineresults.


Reply