<!-- Run Job Synchronously Example from FME Server Developer Playground -->
<!DOCTYPE html>
<html>
<head>
<title>Run Job Synchronously Example from FME Server Developer Playground</title>
<!-- Styles for example -->
<link rel="stylesheet" href="https://playground.fmeserver.com/css/FMEServerExamples.css" type="text/css" />
<!-- Include FMEServer.js -->
<script type="text/javascript" src="https://api.fmeserver.com/js/v1.2/FMEServer.js"></script>
</head>
<body>
<script type="text/javascript">
var repository, workspace
repository = "Samples"
workspace = "Exercise_1.fmw"
FMEServer.init({
//server : "https://demos-safe-software.fmecloud.com",
//token : "568c604bc1f235bbe137c514e7c61a8436043070"
server : "http://my_machine_name",
token : "efaf574d3a0068ac1beca24c4d5d04d89dbe7c64"
// Get the workspace parameters from FME Server
//FMEServer.getWorkspaceParameters( repository, workspace, populateForm );
});
function showResults( json ) {
// The following is to write out the full return object
// for visualization of the example
var hr = document.createElement( "hr" );
var div = document.createElement( "div" );
div.innerHTML = "<h4>Return Object:</h4><pre>"+JSON.stringify(json, undefined, 4)+"</pre>";
document.body.appendChild( hr );
document.body.appendChild( div );
}
// Create the the publishedParameters array, and a checkboxes object
var params = {
"publishedParameters" : a
{
"defaultValue": "test",
"name": "SourceDataset_FILEGDB",
"value": "C:\\Temp\\Automate_training\\fme_input\\CommunityMap.gdb",
"description": "File Geodatabase",
"model": "string",
"optional": 0,
"type": "SOURCE_GEODATABASE"
},
{
"defaultValue": "test",
"name": "DestDataset_GPXX",
"value": "C:\\Temp\\Automate_training\\fme_output",
"description": "Destination GPS eXchange Format (GPX) File",
"model": "string",
"optional": 0,
"type": "FILENAME"
}
]
}
// Submit Job to FME Server and run synchronously
FMEServer.submitJob( repository, workspace, params, showResults );
</script>
</body>
</html>
Hi @sidrashaheen, thanks for the question!
One mistake I have made in the past is appending /fmeserver to the server name in the FMEServer.init object so it looks like
http://myhost/fmeserver instead of
http://myhost. If that's not it, do you see any errors printed to the console if you open your browser's developer tools and run your page?
Nathan
Hi @sidrashaheen, thanks for the question!
One mistake I have made in the past is appending /fmeserver to the server name in the FMEServer.init object so it looks like
http://myhost/fmeserver instead of
http://myhost. If that's not it, do you see any errors printed to the console if you open your browser's developer tools and run your page?
Nathan
hanks for replying, Nathan.
I was able to submit the same job successfully using a python script. I used the same server and token values for this(html/JS) script as well. I don't see any error messages on console:
Only this message appears on the console:
"HTML1300: Navigation occurred."
You can see my test code in the comment section under my original question.
Thanks again
Hi @sidrashaheen, a JavaScript function embedded in a Web page (HTML document) is event-driven, won't be called unless an associated event has occurred. Why not replicate an example from FME Server Playground at first?
In the "Run Job Asynchronously", for example, the "FMEServer.init" function will be called within the "window.onload" function, which will be called by the browser when the Web page has been loaded; the "FMEServer.submitJob" function will be called within the "submitJob" function, which is associated to the "onclick" event of the "Submit Job" button; the "Submit Job" button will be created within the "populateForm" function, which is the callback passed to the "FMEServer.getWorkspaceParameters" function, which will be called within the "window.onload" function.
"HTML1300: Navigation occurred." is just an informational message that appears when a Web page has been loaded.
Thanks, Takashi.
The information that you provided definitely helped me. I am a JS newbie :)
I will update my script keeping the event driven calls in mind. Hopefully it would resolve the issue that I am facing.
Hi @sidrashaheen, a JavaScript function embedded in a Web page (HTML document) is event-driven, won't be called unless an associated event has occurred. Why not replicate an example from FME Server Playground at first?
In the "Run Job Asynchronously", for example, the "FMEServer.init" function will be called within the "window.onload" function, which will be called by the browser when the Web page has been loaded; the "FMEServer.submitJob" function will be called within the "submitJob" function, which is associated to the "onclick" event of the "Submit Job" button; the "Submit Job" button will be created within the "populateForm" function, which is the callback passed to the "FMEServer.getWorkspaceParameters" function, which will be called within the "window.onload" function.
"HTML1300: Navigation occurred." is just an informational message that appears when a Web page has been loaded.
Thanks, Takashi.
It seems to be an SSL related issue. I will have a further look.