Filemaker Server 15 Custom Web Publishing Guide File Maker Fms15 Cwp

User Manual: filemaker FileMaker Server 15 - Custom Web Publishing Guide Free User Guide for FileMaker Software, Manual

Open the PDF directly: View PDF PDF.
Page Count: 96

DownloadFilemaker Server 15 Custom Web Publishing Guide File Maker - Fms15 Cwp
Open PDF In BrowserView PDF
FileMaker Server 15
®

Custom Web Publishing Guide

© 2004–2016 FileMaker, Inc. All Rights Reserved.
FileMaker, Inc. 
5201 Patrick Henry Drive
Santa Clara, California 95054
FileMaker and FileMaker Go are trademarks of FileMaker, Inc. registered in the U.S. and other countries. The file folder
logo and FileMaker WebDirect are trademarks of FileMaker, Inc. All other trademarks are the property of their respective
owners.
FileMaker documentation is copyrighted. You are not authorized to make additional copies or distribute this
documentation without written permission from FileMaker. You may use this documentation solely with a valid licensed
copy of FileMaker software.
All persons, companies, email addresses, and URLs listed in the examples are purely fictitious and any resemblance to
existing persons, companies, email addresses, or URLs is purely coincidental. Credits are listed in the
Acknowledgments documents provided with this software. Mention of third-party products and URLs is for informational
purposes only and constitutes neither an endorsement nor a recommendation. FileMaker, Inc. assumes no
responsibility with regard to the performance of these products.
For more information, visit our website at http://www.filemaker.com.
Edition: 01

Contents
Preface
About this guide
Where to find FileMaker documentation

Chapter 1
Introducing Custom Web Publishing
About the Web Publishing Engine
How a Web Publishing Engine request is processed
Custom Web Publishing with XML
Custom Web Publishing with PHP
Comparing XML to PHP
Reasons to choose XML
Reasons to choose PHP

Chapter 2
Preparing databases for Custom Web Publishing
Enabling Custom Web Publishing in a database
Accessing a protected database
Protecting your published databases
Web server support for Internet media types (MIME)
About publishing the contents of container fields on the web
Container field objects embedded in a database
Container fields with stored file references
Container fields with externally stored data
Container fields and progressive download
How web users view container field data
FileMaker scripts and Custom Web Publishing
Script tips and considerations
Script behavior in Custom Web Publishing solutions
Script triggers and Custom Web Publishing solutions

Chapter 3
About Custom Web Publishing with XML
Creating dynamic websites with the Web Publishing Engine
Key features in Custom Web Publishing with XML
Web publishing requirements
What is required to publish a database using Custom Web Publishing
What web users need to access a Custom Web Publishing solution
Connecting to the Internet or an intranet
Where to go from here

8
8
8

9
10
10
11
11
11
11
11

12
12
12
13
14
14
14
15
15
16
17
17
17
18
18

19
19
19
20
20
20
21
21

4

Chapter 4
Accessing XML data with the Web Publishing Engine
Using Custom Web Publishing with XML
Differences between the Web Publishing Engine and FileMaker Pro XML Import/Export
How the Web Publishing Engine generates XML data from a request
General process for accessing XML data from the Web Publishing Engine
About the URL syntax for XML data and container objects
About the URL syntax for XML data
About the URL syntax for FileMaker container objects in XML solutions
About URL text encoding
Accessing XML data via the Web Publishing Engine
About namespaces for FileMaker XML
About FileMaker database error codes
Retrieving the document type definitions for the FileMaker grammars
Using the fmresultset grammar
Description of elements in the fmresultset grammar
Example of XML data in the fmresultset grammar
Using other FileMaker XML grammars
Description of elements in the FMPXMLRESULT grammar
Example of XML data in the FMPXMLRESULT grammar
Description of elements in the FMPXMLLAYOUT grammar
Example of XML data in the FMPXMLLAYOUT grammar
About UTF-8 encoded data
Using FileMaker query strings to request XML data
Switching layouts for an XML response
Understanding how an XML request is processed
Troubleshooting XML document access

Chapter 5
Valid names used in XML query strings
About the query commands and parameters
Guidelines for using query commands and parameters
Query command parsing
About the syntax for a fully qualified field name
Using query commands with portal fields
About the syntax for specifying a global field
Query command reference
–dbnames (Database names) query command
–delete (Delete record) query command
–dup (Duplicate record) query command
–edit (Edit record) query command
–find, –findall, or –findany (Find records) query commands
–findquery (Compound find) query command
–layoutnames (Layout names) query command
–new (New record) query command
–scriptnames (Script names) query command
–view (View layout information) query command

22
22
22
23
24
24
24
25
26
26
27
27
27
28
28
30
31
31
32
33
35
36
36
38
38
39

40
40
40
41
42
42
44
44
44
44
45
45
45
46
47
47
47
47

5

Query parameter reference
–db (Database name) query parameter
–delete.related (Portal records delete) query parameter
–field (Container field name) query parameter
fieldname (Non-container field name) query parameter
fieldname.op (Comparison operator) query parameter
–lay (Layout) query parameter
–lay.response (Switch layout for response) query parameter
–lop (Logical operator) query parameter
–max (Maximum records) query parameter
–modid (Modification ID) query parameter
–query (Compound find request) query parameter
–recid (Record ID) query parameter
–relatedsets.filter (Filter portal records) query parameter
–relatedsets.max (Limit portal records) query parameter
–script (Script) query parameter
–script.param (Pass parameter to Script) query parameter
–script.prefind (Script before Find) query parameter
–script.prefind.param (Pass parameter to Script before Find) query parameter
–script.presort (Script before Sort) query parameter
–script.presort.param (Pass parameter to Script before Sort) query parameter
–skip (Skip records) query parameter
–sortfield (Sort field) query parameter
–sortorder (Sort order) query parameter

Chapter 6
About Custom Web Publishing with PHP
Key features in Custom Web Publishing with PHP
Custom Web Publishing requirements
What is required to publish a database using Custom Web Publishing
What web users need to access a Custom Web Publishing solution
Connecting to the Internet or an intranet
Manually installing the FileMaker API for PHP
Where to go from here

Chapter 7
Overview of Custom Web Publishing with PHP
How the Web Publishing Engine works with PHP solutions
General steps for Custom Web Publishing with PHP

48
48
48
48
48
49
50
50
51
51
51
52
53
53
54
54
55
55
55
56
56
56
57
57

59
59
59
59
60
60
61
62

63
63
63

6

Chapter 8
Using the FileMaker API for PHP
Where to get additional information
FileMaker API for PHP Reference
FileMaker API for PHP support
Using the FileMaker class
FileMaker class objects
FileMaker command objects
Decoding data for use in the FileMaker API
Connecting to a FileMaker database
Working with records
Creating a record
Duplicating a record
Editing a record
Deleting a record
Running FileMaker scripts
Obtaining the list of available scripts
Running a FileMaker script
Running a script before executing a command
Running a script before sorting a result set
Running a script after the result set is generated
Script execution order
Working with FileMaker layouts
Using portals
Listing the portals defined on a specific layout
Obtaining portal names for a specific result object
Obtaining information about portals for a specific layout
Obtaining information for a specific portal
Obtaining the table name for a portal
Obtaining the portal records for a specific record
Creating a new record in a portal
Deleting a record from a portal
Using value lists
Obtaining the names of all value lists for a specific layout
Obtaining an array of all value lists for a specific layout
Obtaining the values for a named value list
Performing find requests
Using the Find All command
Using the Find Any command
Using the Find command
Using a Compound Find command
Processing the records in a result set
Limiting the portal rows returned by find requests
Pre-validating commands, records, and fields
Pre-validating records in a command
Pre-validating records
Pre-validating fields
Processing the validation errors
Handling errors

65
65
65
65
66
66
66
67
67
67
68
68
69
69
69
69
70
70
70
70
71
71
72
72
72
72
72
72
73
73
73
73
73
74
74
75
75
76
76
76
78
79
79
81
81
81
81
83

7

Chapter 9
Staging, testing, and monitoring a site
Staging a Custom Web Publishing site
Testing a Custom Web Publishing site
Examples of stylesheets for testing XML output
Monitoring your site
Using the web server access and error logs
Using the Web Publishing Engine log
Using the Web Server Module error log
Using the Tomcat logs

Appendix A
Error codes for Custom Web Publishing
Error code numbers in XML format
Error code numbers for FileMaker databases

Index

84
84
85
86
86
87
87
89
89

90
90
90
91

Preface
About this guide
This guide assumes you are experienced with using FileMaker® Pro to create databases. You
should understand the basics of FileMaker Pro database design and the concepts of fields,
relationships, layouts, portals, and containers. For information about FileMaker Pro, see
FileMaker Pro Help.
This guide also assumes you are experienced with developing websites, especially with using
technologies like XML or PHP to integrate FileMaker data with websites and web applications.
This guide provides the following information about Custom Web Publishing with
FileMaker Server:

1 what is required to develop a Custom Web Publishing solution
1
1
1
1

how to publish your databases using XML
how to obtain XML data from databases hosted by FileMaker Server
how to publish your databases using PHP
how to use the FileMaker API for PHP to obtain data from databases hosted by
FileMaker Server

1 what web users need to access a Custom Web Publishing solution

Where to find FileMaker documentation
1 In FileMaker Server Admin Console, choose Help menu > FileMaker Server Product
Documentation.

1 Click the links on the FileMaker Server Admin Console Start Page.
1 To learn about, view, or download additional FileMaker documentation, visit
http://www.filemaker.com/documentation.

Online Help is accessible from FileMaker Server Admin Console. Choose Help menu >
FileMaker Server Help.

Chapter 1 
Introducing Custom Web Publishing
With FileMaker Server, you can publish your FileMaker database on the Internet or an intranet in
these ways.
FileMaker WebDirect: With FileMaker WebDirect, you can quickly and easily publish layouts from
a database on the web. You don’t need to install additional software—with compatible web
browser software and access to the Internet or an intranet, web users can connect to your
FileMaker WebDirect solution to view, edit, sort, or search records, if you give them access
privileges.
With FileMaker WebDirect, the host computer must be running FileMaker Server. The user
interface resembles the desktop FileMaker Pro application. The webpages and forms that the web
user interacts with are dependent on the layouts and views defined in the FileMaker Pro database.
See FileMaker WebDirect Guide.
Static publishing: If your data rarely changes, or if you don’t want users to have a live connection
to your database, you can use static publishing. With static publishing, you export data from a
FileMaker Pro database to create a webpage that you can further customize with HTML. The
webpage doesn’t change when information in your database changes, and users don’t connect to
your database. (With FileMaker WebDirect, the data is updated in the web browser whenever the
data is updated in the database.) See FileMaker Pro Help.
Custom Web Publishing: To integrate your FileMaker database with a custom website, use the
Custom Web Publishing technologies available with FileMaker Server. FileMaker Server, which
hosts the published databases, does not require FileMaker Pro to be installed or running for
Custom Web Publishing to be available.
With Custom Web Publishing, you can:

1 Integrate your database with another website
1 Determine how users interact with data
1 Control how data displays in web browsers
FileMaker Server provides two Custom Web Publishing technologies:

1 Custom Web Publishing with XML: Use XML data publishing to exchange FileMaker data with

other websites and applications. By using HTTP URL requests with FileMaker query
commands and parameters, you can query a database hosted by FileMaker Server, download
the resulting data in XML format, and use the resulting XML data in whatever way you want.

1 Custom Web Publishing with PHP: Use the FileMaker API for PHP, which provides an object-

oriented PHP interface to FileMaker Pro databases, to integrate your FileMaker data into a PHP
web application. Because you code the PHP webpages yourself, you have complete control
over the user interface and how the user interacts with the data.

Chapter 1 | Introducing Custom Web Publishing

10

About the Web Publishing Engine
To support FileMaker WebDirect and Custom Web Publishing, FileMaker Server uses a set of
software components called the FileMaker Server Web Publishing Engine. The Web Publishing
Engine handles interactions between a web user’s browser, your web server, and
FileMaker Server.
Custom Web Publishing with XML: Web users access your Custom Web Publishing solution by
clicking an HREF link or by entering a Uniform Resource Locator (URL) that specifies the web
server address and a FileMaker query string request. The Web Publishing Engine returns the XML
data specified in the query string request.
Custom Web Publishing with PHP: When a web user accesses your Custom Web Publishing
solution, PHP on FileMaker Server connects with the Web Publishing Engine and responds
through the FileMaker API for PHP.

Products.fmp12

1

2
Web Server

Web
Browser

3
Web Publishing
Engine

Web Server Module
FM API and PHP code

6

Customers.fmp12

Database
Server

Web Publishing Core

5

4

Using the FileMaker Server Web Publishing Engine for Custom Web Publishing

How a Web Publishing Engine request is processed
1. A request is sent from a web browser or application to the web server.
2. The web server routes the request through FileMaker Web Server Module to the Web
Publishing Engine.
3. The Web Publishing Engine requests data from the database hosted by the Database Server.
4. The FileMaker Server sends the requested FileMaker data to the Web Publishing Engine.
5. The Web Publishing Engine converts the FileMaker data to respond to the request.

1 For PHP requests, the FileMaker API for PHP converts the PHP request into an XML

request. The Web Publishing Engine processes the XML request and sends XML data back
to the FileMaker API for PHP. The FileMaker API for PHP then converts the XML data into
PHP objects that can be used by the PHP application.

1 For XML requests, the Web Publishing Engine sends XML data directly to the web server.
6. The web server sends the output to the requesting web browser or program.
Important Security is important when you publish data on the web. Review the security
guidelines in FileMaker Security Guide.
For information about getting a database ready for Custom Web Publishing, see chapter 2,
“Preparing databases for Custom Web Publishing.”

Chapter 1 | Introducing Custom Web Publishing

11

Custom Web Publishing with XML
FileMaker Custom Web Publishing with XML enables you to send query requests to a
FileMaker Pro database hosted by FileMaker Server and to display, modify, or manipulate the
resulting data. Using an HTTP request with the appropriate query commands and parameters, you
can retrieve FileMaker data as an XML document. You can then export the XML data to other
applications.

Custom Web Publishing with PHP
The FileMaker API for PHP provides an object-oriented PHP interface to FileMaker databases. The
FileMaker API for PHP enables both data and logic stored in a FileMaker Pro database to be accessed
and published on the web, or exported to other applications. The API also supports complex and
compound find commands for extracting and filtering data stored in FileMaker Pro databases.
Originally designed as a procedural programming language, PHP has been enhanced as an objectoriented web development language. PHP provides programming language functionality for constructing
virtually any type of logic within a site page. For example, you can use conditional logic constructs to
control page generation, data routing, or workflow. PHP also provides for site administration and security.

Comparing XML to PHP
The following sections provide some guidelines for determining the best solution for your site.

Reasons to choose XML
1 FileMaker XML request parameter syntax is designed for database interaction, which simplifies
solution development.

1 XML is a W3C standard.
1 XML is a machine- and human-readable format that supports Unicode, enabling data to be
communicated in any written language.

1 XML is well-suited for presenting records, lists, and tree-structured data.
1 You can use FMPXMLRESULT for accessing XML data using Custom Web Publishing and for
exporting XML from FileMaker Pro databases.

Note For information about Custom Web Publishing with XML, see chapter 3, “About Custom
Web Publishing with XML.”

Reasons to choose PHP
1 PHP is a more powerful, object-oriented procedural scripting language, but is relatively easy to
learn. There are many resources available for training, development, and support.

1 The FileMaker API for PHP enables data and logic stored in a FileMaker Pro database to be
accessed and published on the web, or exported to other applications.

1 PHP lets you use conditional logic to control page construction or flow.
1 PHP provides programming language functionality for constructing many types of logic on a site
page.

1 PHP is one of the most popular web scripting languages.
1 PHP is an open source language, available at http://php.net.
1 PHP enables access to a wide variety of third-party components that you can integrate into your
solutions.

Note For information about Custom Web Publishing with PHP, see chapter 6, “About Custom
Web Publishing with PHP.”

Chapter 2 
Preparing databases for Custom Web
Publishing
Before you can use Custom Web Publishing with a database, you must prepare the database and
protect it from unauthorized access.

Enabling Custom Web Publishing in a database
You must enable a Custom Web Publishing extended privilege in each database you want to
publish. If you don’t enable a Custom Web Publishing extended privilege in the database, web
users won’t be able to use Custom Web Publishing to access the database even if it is hosted by
FileMaker Server that is configured to support a Web Publishing Engine.
To enable Custom Web Publishing for a database:
1. In FileMaker Pro, open the database you want to publish using an account that has the Full
Access privilege set. Alternatively, you can open the database using an account that has the
Manage Extended Privileges access privileges.
2. Assign the Custom Web Publishing extended privilege that you want to use:

1 For Custom Web Publishing with XML, use fmxml
1 For Custom Web Publishing with PHP, use fmphp
3. Assign the privilege set(s) that include the Custom Web Publishing extended privilege to one
or more accounts, or to the Admin or Guest account.
Note When defining account names and passwords for Custom Web Publishing solutions, use
printable ASCII characters, for example a-z, A-Z, and 0-9. For more secure account names and
passwords, include punctuation characters such as “!” and “%,” but do not include colons. For
information on setting up accounts, see FileMaker Pro Help.

Accessing a protected database
Custom Web Publishing enables you to restrict access to your published databases through
database password protection, database encryption, and secure connections. When using a
Custom Web Publishing solution to access a database, web users may be prompted for their
account information. If the Guest account for the database is disabled or does not have a privilege
set enabled that includes a Custom Web Publishing extended privilege, the Web Publishing
Engine uses HTTP Basic Authentication to request authentication from web users. The web user’s
browser displays the HTTP Basic Authentication dialog box for the user to enter a user name and
password for an account that has a Custom Web Publishing extended privilege.

Chapter 2 | Preparing databases for Custom Web Publishing

13

The following list summarizes the process that occurs when a web user uses a Custom Web
Publishing solution to access a database:

1 If you have not assigned a password for an account, web users only specify the account name.
1 If the Guest account is disabled, then users will be prompted for account name and password
when they access the database. The account must have a Custom Web Publishing extended
privilege enabled.

1 If the Guest account is enabled and has a privilege set enabled that includes a Custom Web

Publishing extended privilege, all web users automatically open the database with the access
privileges assigned to the Guest account. If the Custom Web Publishing extended privilege is
assigned to the Guest account:

1 Web users are not prompted for an account name and password when opening a file.
1 All web users will automatically log in with the Guest account and assume the Guest account
privileges. You can let users change their login accounts from a web browser with the 
Re-Login script step (for example, to switch from the Guest account to an account with more
privileges).

1 The default privilege set for Guest accounts provides “read-only” access. You can change
the default privileges, including Extended Privileges, for this account. See FileMaker Pro
Help.

1 When a web user has entered valid account information, that account information is reused as
long as the browser session has not timed out. When the browser session times out, then the
web user is again prompted to enter a valid account.

Note By default, web users cannot modify their account password from a web browser. You can
build this feature into a database with the Change Password script step, which allows web users
to change their passwords from their browser. See FileMaker Pro Help.

Protecting your published databases
When using Custom Web Publishing, you can limit who can access your published databases.

1 Assign passwords to database accounts that are used for Custom Web Publishing.
1 Enable a Custom Web Publishing extended privilege only in the privilege sets for accounts that
you want to allow access to your published databases.

1 Disable the Custom Web Publishing extended privilege for a specific database by deselecting

the fmxml or fmphp extended privilege for all privilege sets in that database. See FileMaker Pro
Help.

1 Enable or disable Custom Web Publishing for all Custom Web Publishing solutions in the Web
Publishing Engine using FileMaker Server Admin Console. See FileMaker Server Getting
Started Guide and FileMaker Server Help.

1 Configure your web server to restrict the IP addresses that can access your databases via the

Web Publishing Engine. For example, you can specify that only web users from the IP address
192.168.100.101 can access your databases. For information on restricting IP addresses, see
the documentation for your web server.

Chapter 2 | Preparing databases for Custom Web Publishing

14

FileMaker Server supports encryption for data written to disk and for data transmitted to clients.

1 Encrypt your database by using the Database Encryption feature of FileMaker Pro Advanced.
Encryption protects the FileMaker database file and any temporary files written to disk. For
information on encrypting a database, see FileMaker Server Getting Started Guide and
FileMaker Pro Help.

1 An encrypted database that is hosted on FileMaker Server is opened by using Admin

Console or the command line interface (CLI). As the FileMaker Server administrator, you
open the file with its database encryption password, so that FileMaker clients can use the
encrypted database.

1 Once the FileMaker encrypted database is opened with the encryption password by the

FileMaker Server administrator, FileMaker clients don’t need the encryption password to
access the encrypted database. For information about opening an encrypted database, see
FileMaker Server Help.

1 Use Secure Sockets Layer (SSL) encryption for communication between the web server and

web browsers. SSL connections are accessed through an HTTPS connection.
FileMaker Server provides a standard SSL certificate signed by FileMaker, Inc. that does not
verify the server name. The FileMaker default certificate is intended only for test purposes. A
custom SSL certificate is required for production use. See FileMaker Server Getting Started
Guide.

For information on securing your database, see FileMaker Security Guide.
Note For security reasons, webpages hosted by other web servers may not use the