Many of us have upgraded our servers to v13 but not necessarily our clients. In order to use some new v13 commands I had to come up with a way to emulate Perform Script on Server (PSoS) on v12 clients. My application needed this feature to use  Tim Deitrich's FM EasyAudit with an older client. If you don't already know about it, its a great super lightweight auditing module. 

Problem: 

PSoP is not supported on version 12.

Need a way to communicate with remote servers without a direct FMP connection.

Solution:

Run the remote script via CWP/XML and web publishing.

Sample URL Format:
http://username:password@MyServer.com/fmi/xml/fmresultset.xml?-db=MyDataBaseName&-lay=TheLayoutToRunScriptFrom&-findany&-script=TheScriptNameToRun&-script.param="

If you are passing large script params use 'httppost' as the prefix as it will support larger params via POST and not GET.

Caveats:

Because the connection to the server is not live there can be an initial DNS lookup and delay time.

Calling a remote script via InsertFromURL must wait until the remote script completes before the 'insert' can happen. If the URL is called from a web viewer, then the foreground application can carry on not worrying about waiting for the results from the remote call.

Web publishing must be turned on with XML enabled. (Results of the found record set are returned in XML

The local context (layout, active fields etc.) are not carried through. Think of the remote call as a brand new client session.

Applications:

In addition to v12 compatibility, this technique allows remote servers to be called without an active FMP connection to that server.

FMP Stand alone clients can connect to FMP servers bypassing the licensing restrictions. 

I use this technique to perform server to server syncs over HTTP port 80.

Buttons on web pages and other applications can communicate with FMP and run scripts.

You can create multiple threads running on a server (good for things that have long or slow running loops. (Be careful to keep them well behaved.)

I user this to build REST API's for HTML5 applications (The API will not be name spaced but thats fine because you can pass script and layout parameters fine.

Have more ideas, let me know.

Charles

 

1 Comment