Permits a database server to act as a Web server.
Syntax
CREATE SERVICE <service-name-string>
TYPE service-type-string
[ attributes ] [
AS <statement> ]
service-type-string - (back to Syntax)
{ 'RAW '
| 'HTML '
| 'XML '
| 'SOAP '
| 'DISH ' }
attributes - (back to Syntax)
[ AUTHORIZATION { ON | OFF } ]
[ SECURE { ON | OFF } ]
[ USER { <user-name> | NULL } ]
[ URL [ PATH/ ] { ON | OFF | ELEMENTS } ]
[ USING { <SOAP-prefix> | NULL } ]
Parameters
(back to top)
- service-name-string Web service names may be any sequence of
alphanumeric characters or “/”, “-”, “_”, “.”, “!”, “~”, “*”, “'”, “(“, or “”)”,
except that the first character cannot begin with a slash (/) and the name cannot
contain two or more consecutive slash characters.
- AUTHORIZATION
determines whether users must specify a user name and
password when connecting to the service. The default value is ON.
- If authorization is OFF, the AS clause is required and a single user must be
identified by the USER clause. All requests are run using that user’s account and
permissions.
- If authorization is ON, all users must provide a user name and password. Optionally,
you can limit the users that are permitted to use the service by providing a user or
role name using the USER clause. If the user name is NULL, all known users can
access the service.
Run production systems with authorization turned on.
Grant permission to use the service by adding users to a role.
- SECURE indicates whether unsecure connections are
accepted. ON indicates that only HTTPS connections are to be accepted. Service
requests received on the HTTP port are automatically redirected to the HTTPS port.
If set to OFF, both HTTP and HTTPS connections are accepted. The default value is
OFF.
- USER if authorization is disabled, this parameter
becomes mandatory and specifies the user ID used to execute all service requests. If
authorization is enabled (the default), this optional clause identifies the user or
role permitted access to the service. The default value is NULL, which grants access
to all users.
- URL determines whether URI paths are accepted and, if
so, how they are processed. OFF indicates that nothing must follow the service name
in a URI request. ON indicates that the remainder of the URI is interpreted as the
value of a variable named <url>. ELEMENTS indicates that the
remainder of the URI path is to be split at the slash characters into a list of up
to 10 elements. The values are assigned to variables named url plus a numeric suffix
of between 1 and 10; for example, the first three variable names are url1, url2,
and url3. If fewer than 10 values are supplied, the remaining variables are set to
NULL. If the service name ends with the character /, then URL must be set to OFF.
The default value is OFF.
- USING applies only to DISH services. The parameter
specifies a name prefix. Only SOAP services whose names begin with this prefix are
handled.
- service-type-string
identifies the type of the service. The type must be
one of the listed service types. There is no default value.
- RAW – sends the result set to the client without any further
formatting. You can produce formatted documents by generating the required tags
explicitly within your procedure.
- HTML – formats the result set of a
statement or procedure into an HTML document that contains a table.
- XML – assumes the result set is an XML format. If it is not
already so, it is automatically converted to XML RAW format.
- SOAP – formats the result set as a
Simple Object Access Protocol (SOAP) response. The request must be a valid SOAP
request. For more information about the SOAP standards, see www.w3.org/TR/SOAP
- DISH – determine SOAP Handler, or DISH, service acts as a proxy
for one or more SOAP services. In use, it acts as a container that holds and
provides access to a number of SOAP services. A Web Services Description Language
(WSDL) file is automatically generated for each of the included SOAP services. The
included SOAP services are identified by a common prefix, which must be specified in
the USING clause.
- statement
if the statement is NULL, the URI must specify the
statement to be executed. Otherwise, the specified SQL statement is the only one that
can be executed through the service. The statement is mandatory for SOAP services, and
ignored for DISH services. The default value is NULL.
All services that are run in production systems must
define a statement. The statement can be NULL only if authorization is enabled.
Examples
(back to top)
- Example 1 sets up a Web server quickly, start a database server with the
-xs switch, then execute this statement:
CREATE SERVICE tables TYPE 'HTML'
AUTHORIZATION OFF USER DBA
AS SELECT * FROM SYS.ISYSTAB
After executing this statement, use any Web browser to open the URL
http://localhost/tables.
Usage
(back to top)
The CREATE SERVICE statement causes the database server to act as a web
server. A new entry is created in the SYSWEBSERVICE system table.
In a multiplex, execute CREATE
SERVICE on both the coordinator and each secondary node that will act as a web
server.
Standards
(back to top)
- SQL—ISO/ANSI SQL compliant.
- SAP Database products—Not supported by SAP ASE.
Permissions
(back to top)
Requires
the MANAGE ANY WEB SERVICE system privilege.