Web Service Publish

Create web services for publishing data. This is not a component and therefore menu items are not created for it.

The system setting 'WebServiceEnabled' must be set and services must be configured in the Web service publishing menu group.

Note: For development servers use the full URL https://servername.softadmin.se/...

Component modes: Publish data | Update data

Component mode: Publish data

Configuration

To enable Web services in your system you must perform the following configuration steps:

  1. Create/Reuse an application pool. The application pool should be different from the one running Softadmin and must be in integrated pipeline mode.
  2. Convert the "webservices" folder to an application, or set up a separate site for it.
  3. Set the application variable "WebServiceEnabled" to 1.
  4. Configure application variable "WebServiceURLBaseSoftadminServices". This should contain the URL to the web service application folder configured in step 2.
  5. Optional. Set up an IP-filter in the IIS.
  6. Optional. Make additional adjustments to comply with additional organisation rules.
  7. Set up the web services using the web service menu item.

The steps 1 through 6 needs to be performed after first deploy as well.

Common errors

An error always occurs when saving meta data.

The system setting "WebServiceURLBaseSoftadminServices" is most likely wrong, make sure the url is reachable.

SQL

SQL Call: Publish data

May modify database: No

Parameters

@<fieldname> string
Any field that is part of the input entity.
@<UrlParameter> string
Value of any parameter in the URL. Parameters are created by adding {myparam} in the metadata URLSuffix.

Resultset: Get Response

Table count: repeated one or more times
Row count: zero or more rows
Columns
<Primarykey_Column> mandatory int
First column in table is used to identify resultset
<Column> optional string
Any other column that should be a field in the response
<Foreignkey_Column> optional int
Used to connect resultset to the <Primarykey_Column> of other resultsets.

Resultset: Http error code (optional)

This must always be the last table in the resultset. Used to control the HTTP status code returned from REST web services.

Table count: repeated zero or one time
Row count: exactly one row
Columns
HttpStatusCode mandatory int
HTTP Status Code in the 400 to 599 range indicating an error has occured.

Resultset: #HttpHeader (optional)

Contains the custom request HTTP headers.
Table count: repeated zero or one time
Row count: zero or more rows
Columns
HttpHeaderName mandatory string
Contains the name of the header.
HttpHeaderValue mandatory string
Contains the value of the header.

Examples

Publish data

CREATE PROCEDURE dbo.GetPersonInfo
	@PersonId int
AS
BEGIN
	SELECT
		P.PersonId,
		P.PersonName
	FROM
		Registry.Person P
	WHERE
		P.PersonId = @PersonId;

	SELECT
		A.AddressId,
		A.PersonId,
		A.Street
	FROM
		Registry.Address A
	WHERE
		A.PersonId = @PersonId;
END;

Best practice

Error handling

The best way to handle errors that should be sent to the caller is to create an error entity which contains information about the error and potentially a success bit.

RAISERROR can be used for internal errors as these errors are logged but only displayed to the caller in the development environment.