Creating a Web Service

Create a Web service to facilitate data transfer with SOAP or HTTP.

Prerequisites
Database Version Web Service Privileges
SAP Sybase IQ 15.3 and 15.4 You must have DBA authority.
SAP Sybase IQ 16.0 You must have the MANAGE ANY WEB SERVICE system privilege.
Task
Web service definitions are stored in the system store (catalog store) only.
  1. From the application menu bar, select View > Open > Administration Console.
  2. In the left pane, expand IQ Servers > Compiled Objects, and then select Web Services.
  3. Click the arrow next to Web Services and select New.
    The Create Web Service Wizard appears.
  4. On the Welcome page, specify:
    Option Description
    Select a resource for which the web service will be created From the list, select the resource for which the Web service will be created.
    (Multiplex only) Select a multiplex server on which to we service will be created? From the list, select the multiplex server on which the Web service will be created.
    SCC agent status The SCC agent for the multiplex server must be registered and authenticated in order to create a Web service on it. If the SCC Agent status indicates unregistered, click the Register Agent and Authenticate Agent buttons to register and authenticate.
    What do you want to name the new web service? Enter a unique name for the new procedure; maximum of 128 characters. The Web service name must not begin or end with a slash (/) or contain two or more consecutive slashes.
  5. Click Next.
  6. On the Type page, specify:
    Option Description
    Which type of web service do you want to create?` From the list, select the Web service type. Valid values are:
    • Raw – the result set of the SQL statement or procedure is sent to the client without any additional formatting. You must enable authorization if this service does not have a statement.
    • XML – the result set of the SQL statement or procedure is assumed to be XML; if it is not, then the result set is converted to XML RAW format. You must enable authorization if this service does not have a statement.
    • HTML – the result set of the SQL statement or procedure is formatted as an HTML document with a table containing the rows and columns. You must enable authorization if this service does not have a statement.
    • JSON – the result set of the SQL statement or procedure is formatted as JSON (JavaScript Object Notation) serialized data represented as an array of row structures containing column and value pairs. You must enable authorization if this service does not have a statement.
    • SOAP – the request must be a valid SOAP (Simple Object Access Protocol) request, and the result set is formatted as a SOAP response.
    • DISH – a DISH service acts as a proxy for a group of SOAP services and generates a WSDL (Web Services Description Language) file for each of its SOAP services.
    Do you want this web service to be enabled. Select to enable the Web service.
  7. Click Next.
  8. (For Raw, XML, HTML or JSON service types only) On the URL Path page, specify whether the remainder of the URL path is permitted, and if so, how it is processed. Valid values are:
    Option Description
    Off

    The remainder of the URL path is not permitted.

    e.g. http://<host-name>/<service-name>
    On

    The remainder of the URL path is permitted and is set as a single parameter.

    e.g. http://<host-name>/<service-name>/aaa/bbb/ccc url=aaa/bbb/ccc
    Elements

    The remainder of the URL path is permitted and is set as multiple parameters.

    e.g. http://<host-name>/<service-name>/aaa/bbb/ccc url1=aaa, url2=bbb, url3=ccc
  9. Click Next.
  10. For SOAP or DISH service types only) On the Data Payload Format page, specify type of data payload format the Web service should expose. Valid values are:
    Format Description
    Default This format is equivalent to .NET in all cases except for SOAP services that are handled by a DISH service. In such cases, the DISH service's format is used instead of the SOAP service's format.
    .NET This format is used for .NET clients that can accept Microsoft's Dataset format. This is useful to SOAP clients developed with Microsoft and Microsoft-compatible tools.
    Concrete

    This is a generic format used by SOAP toolkits such as JAX-RPC (JAVA) to generate interfaces that correlate to a result set returned by SQL Anywhere.

    Select Expose an explicit response object for this web service to have this web service expose an explicit response object if the service calls a procedure that returns a result set. The XML schema of this object will contain column names and data types based on the result set.

    XML This is the most compatible format; it simply returns the result set as a string. Clients will need to parse this string to access the various elements within it.
  11. Click Next.
  12. For SOAP service type only) On the Data Type Behavior page, specify which data typing behavior to be used for this Web service. Valid formats are:
    Behavior Description
    Off This is the default behavior. No data typing of inputs and outputs (DNET is String only). Equivalent to the behavior in SQL Anywhere version 9.0.x.
    On Supports data typing for input parameters and result set responses.
    In Supports data typing for input parameters only. XML and CONCRETE formats contain no type information; DNET is String only.
    Out Supports data typing for result set responses of all SOAP service formats; input parameters are Strings only.
  13. Click Next.
  14. (For DISH service type only) (Optional) On the Service Name Prefix page, specify a SOAP service name prefix to specify the group of SOAP services that apply to this DISH service. Only those SOAP services whose names begin with this prefix will be handled by this DISH service. Click Next.
  15. On the Methods page, specify the request methods to be enabled for the Web service. Valid methods are:
    Available methods depend on the service type specified.
    Method Description
    HEAD Retrieve information written in a response header.
    GET Request a response
    POST Submit data to be processed by a resource
    PUT Upload a resource
    DELETE Remove a resource
  16. Click Next.
  17. On the Authorization page specify:
    Option Description
    Require authentication for this web service Select if authentication is required to execute the Web service.
    User If user authentication is required, select a user from the list.
  18. Click Next.
  19. On the Security page, select the option to configure the Web service to only be processed if the request is made through a secure (HTTPS) connection. If a request to a secure web service is received on the HTTP port, then the request will be redirected to the HTTPS port. Click Next.
  20. On the SQL Statement page, specify a SQL command, (usually a stored procedure) called when someone accesses a service. Click Next.

    Defining an SQL command is optional for Raw, XML, HTML or JSON service types. You must select the This web service has the following SQL statement option before you can enter the SQL command. For SOAP or DISH service types, the This web service has the following SQL statement option is unavailable since defining an SQL command is mandatory.

    Services without statements cause serious security risk because they permit Web clients to execute arbitrary commands. When creating services without statements, you must enable authorization, which forces all clients to provide a valid user name and password. SAP recommends that all production systems define statements in their services.

    In a non-production environment, you can create services that do not include statements. Services configured in this way can be useful when you are testing a service, or want a general way to access information. Either omit the statement entirely or use the phrase NULL in place of the statement.

  21. (Optional) On the Comment page, specify a comment for the Web service.
  22. Click Finish.
Related tasks
Enabling a Web Service
Disabling a Web Service
Deleting a Web Service
Generating Web Service DDL Commands
Viewing or Modifying Web Services Properties
Authenticating a Login Account for a Managed Resource
Related reference
Web Service Privilege Summary