FileMaker Extra: Write Your Own Web Services

We generally think of Web services as being something that someone else has, and that we want access to. But Web services have many other uses as well. They can provide a powerful way to extend the capabilities of your FileMaker application.

For example, suppose that you needed to compute a Fourier transform, based on some measured signal data. FileMaker has no built-in facility for such analysiscomputing the transform requires complex mathematics. (Well, with enough diligence, you might be able to write a FileMaker script to perform a discrete Fourier transform. But its cousin, the fast Fourier transform, requires mathematical operations FileMaker can perform.)


Don worry if Fourier transforms don ring a bell; this is just a data example. A Fourier transform is an advanced mathematical technique for taking a complex signal, such as a sound or radio wave, and decomposing it into a series of simpler signals.

FileMaker already provides a number of extension mechanisms to developers. Many problems can be solved with a custom function. Those that can may be addressed by a plug-in already in existence.

For more details about installing and using FileMaker plug-ins, see "Plug-ins," p. 771.

Web services provide another way to extend FileMakers capabilities. They are, in our view, easier to write than plug-ins, which require knowledge of a low-level programming language such as C++, and knowledge of how to program in each specific client environment supported by FileMaker 7, namely Windows and the Mac OS. Web services, by contrast, can be written in the lighter-weight scripting languages, which we feel are easier to learn, and because they execute in a server environment, they don require that you have any knowledge of how to program specifically for the Mac or Windows.

Of course, this points up one of the hurdles involved in writing your own Web service: You still have to know how. Web services can be written in a wide variety of programming languages, such as PHP, Perl, JSP, ASP, Visual Basic, Tango, Lasso, or any of many other Web scripting languages, not to mention hard-core languages such as Java, C, and C++. Theres literally no limit to the kinds of work you can perform with Web services written in these languages. The only catch is, again, you have to know how.

Of the languages discussed, we feel the Web scripting languages are probably the most approachable. PHP is a superb general-purpose Web scripting language. JSP has a Java base, whereas ASP and Visual Basic are particular to a Windows server environment. Tango and Lasso were once exclusively FileMaker-aware Web tools, but have since grown into more general-purpose languages. All these languages presume some familiarity with the fundamentals of computer programming, and familiarity with the specific language in question.

Lets return again to the hypothetical example. Lets say you e importing signal data from an electronic instrument of some kind. You have the raw data, and you want to compute a discrete Fourier transform of the samples. Our strategy for doing this is twofold: First we write a Web service capable of doing the math, and then we call that Web service from FileMaker, hand it our data, and get our results back in return.

In a book of this kind, we can explain in detail how to write the kind of Web service that would do this. Conceptually, if you know a language like PHP, you can write a PHP program, designed to be accessed over the Web, which expects to receive a vector of numbers in the request. You would call the Web service via a URL, which might look something like this:

[View full width] "1.0, .45, 3.2, -.23, 1.76, 1.55, 2.01, 1.23, .34, -.78, - .64, -.09"

The samples represent the actual data you are sending to the Web service for processing. You would compose the URL dynamically in FileMaker, much as we demonstrated for the Amazon example earlier in this chapter. The URL accesses the Web server at, requests access to the discrete Fourier transform program, and passes the DFT program a series of sample values. The DFT program processes the information and returns some information. For the purposes of getting the resulting data back into FileMaker, we want to work through the FileMaker XML Import feature, so the DFT program should output XML of some sorteither straight FMPXML that we can import back into FileMaker, or some other XML flavor that we can transform with a stylesheet.

So whats DFT.php? Well, it would be a program, written in the PHP language, that knows how to compute a discrete Fourier transform from a vector of numbers, and output the results in XML. You might choose to write the program in straight PHP. For more advanced math, though, such as the more complex fast Fourier transform, you might choose to use PHP to call a code library on the Web server computer, which would perform the complex math in a very fast language such as C.

The one downside to using Web services in this way (besides the need to learn one or more additional languages) is that the Web service functionality doesn really live "in FileMaker"; it lives on a server someplace, so if you are creating standalone FileMaker applications that are meant to work in a single-user, nonhosted environment, or possibly an environment with no network or Internet connection, home-brew Web services are probably not the way to go.

There are relatively few limits to the kinds of programming tasks you can accomplish in FileMaker, just by hooking FileMaker up to the appropriately written Web service. Of course, those services are not trivial to produce in practice. But if you have the knowledge to do so (or access to someone with such knowledge), the potential uses are almost limitless.

To recap, Web services can provide a way to extend the capabilities of FileMaker. The range of possible functionality is much wider than that afforded by custom functions, and programming Web services is, in general, easier than programming FileMaker plug-ins (which requires writing platform-specific compiled code).

Part I: Getting Started with FileMaker 8

FileMaker Overview

Using FileMaker Pro

Defining and Working with Fields

Working with Layouts

Part II: Developing Solutions with FileMaker

Relational Database Design

Working with Multiple Tables

Working with Relationships

Getting Started with Calculations

Getting Started with Scripting

Getting Started with Reporting

Part III: Developer Techniques

Developing for Multiuser Deployment

Implementing Security

Advanced Interface Techniques

Advanced Calculation Techniques

Advanced Scripting Techniques

Advanced Portal Techniques

Debugging and Troubleshooting

Converting Systems from Previous Versions of FileMaker Pro

Part IV: Data Integration and Publishing

Importing Data into FileMaker Pro

Exporting Data from FileMaker

Instant Web Publishing

FileMaker and Web Services

Custom Web Publishing

Part V: Deploying a FileMaker Solution

Deploying and Extending FileMaker

FileMaker Server and Server Advanced

FileMaker Mobile

Documenting Your FileMaker Solutions

Using FileMaker 8
Special Edition Using FileMaker 8
ISBN: 0789735121
EAN: 2147483647
Year: 2007
Pages: 296 © 2008-2020.
If you may any questions please contact us: