Wraps the supplied SQL statement in a stored procedure with the specified name and parameters.
create service service-name [secure security_options ] [, userpath path] [, alias alias-name] type { xml | raw | soap } [[(@parameter_name datatype [(length ) | (precision [, scale ])] [= default][output] [, @parameter_name datatype [(length ) | (precision [, scale ])] [= default][output]]...[)]] as SQL_statements
security_options ::= (security_option_item [security_option_item])
clear – indicates that HTTP is used to access this Web service.
ssl – indicates HTTPS is used to access this Web service.
soap – implies an HTTP POST request and must be compliant with all the SOAP rules. The data is returned in SQL/XML format.
raw – indicates that the output is to be sent without any alteration or reformatting. This implies an HTTP GET request. The invoked stored procedure can specify the exact output.
xml – indicates that the result set output is returned in SQL/XML format. This implies an HTTP GET request.
1> use pubs2 2> go 1> create service rawservice type raw as select '<html><h1>' + @@version + '</h1></html>' 2> go
The newly created user-defined Web service is then deployed:
1> sp_webservices 'deploy', 'all' 2> go
The Web Service Definition Language for the newly created user-defined Web service is at http://myhost:8181/services/pubs2?wsdl.
http://myhost:8181/services/pubs2?method=rawservice&username=bob&password=bob123
The output, an SAP ASE version string, appears in an HTML <h1> tag in the browser window.
1> use pubs2 2> go 1> create service xmlservice userpath "testing" type xml as select @@version 2> go
The newly created user-defined Web service is then deployed:
1> sp_webservices 'deploy', 'xmlservice' 2> go
http://myhost:8181/services/pubs2/testing?wsdl
http://myhost:8181/services/pubs2/testing?method=xmlervice& username=bob&password=bob123
The output appears as XML in the browser window.
create service sp_who_service userpath 'myservices/args' type soap @loginname varchar(30) as exec sp_who @loginname
http://localhost:8181/pubs2/myservices/args/sp_who_service
http://localhost:8181/pubs2/myservices/args?wsdl
DataReturn[] sp_who_service (xsd:string username, xsd:string password, xsd:string loginname)
The new service is invoked by a SOAP client with one parameter, loginname, of type varchar(30).
Except for the following differences, the resulting stored procedure behaves the same as a stored procedure created with the create procedure command, following existing stored procedure rules for execution, replication, sp_helptext, and recompilation, and is executable from isql:
The resulting stored procedure can be dropped only with the drop service command, not the drop procedure command.
The syscomments table is populated with DDL necessary to re-create the create service command.
The specified service name cannot create a stored procedure group.
ANSI SQL – Compliance level: Transact-SQL extension.
To use a Web service, you must be granted execute permission explicitly:
Permissions on Objects at |
Description |
---|---|
Service creation |
When you create a Web service, SAP ASE makes no permission checks on objects, such as tables and views, that are referenced by the service. Therefore, you can successfully create a Web service even though you do not have access to its objects. All permission checks occur when a user executes the Web service. |
Web service execution |
When the Web service is executed, permission
checks on objects depend on whether the Web service and all referenced
objects are owned by the same user.
|
The following describes permission checks for create service that differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must have the create procedure privilege. You must have create any procedure privilege to use create service for other users. |
Disabled | With granular permissions disabled, you must have the create procedure privilege, be the database owner, or a user with sa_role. You must be a user with sa_role to use create rule for other users. |
Values in event and extrainfo columns of sysaudits are:
Information | Values |
---|---|
Event | 11 |
Audit option | create |
Command or access audited | create services |
Information in extrainfo |
|