Web Service Properties

Fabric Web Services properties include the definitions, methods, categories and essential metadata that contribute to the main functionalities and characteristics of the Web Service.

How Do I Access Web Service Properties?

Go to the Project Tree, right click Web Services and select New Web Service to display the Function Manager window.

drawing

What Are Web Service Properties?

Web Service Properties are located on the top right corner of the Web Service window.

drawing

The following are the Web Services properties:

Property

Description

Name

Name of the assigned Web Service function. The assigned name should be meaningful and should have a ws% prefix.

Category

Characteristics or class of the Web Service. Note that each category has a separate Java file.

Return Type

Type of Output value returned from the Web Service that is displayed in a dropdown list. For example, String, Long, Map, List, Customized Class or Object. Output values in the list can be overridden with new values.  Fabric knows how to serialize complex structures automatically when sent as JSON in the request body.

Version

Representation of the Web Service’s versioning control status. A version is incorporated into the Web Service’s URL and is used to enable several Web Service versions that are all related to the same service. By default, the version is populated by 1.

Versioning Logic 

  • If the version is not part of the URL, the API will respond with the latest version.
  • If the version is part of the URL and the API version exists, the API will respond with the specified version.
  • If the version is part of the URL and the latest API version is lower, the API will respond with the latest version.
  • If the version is part of the URL and is lower than the lowest API version, the API will return the correct error response code.
  • If the version is part of the URL and is in between two API versions, the API will respond with the lower version.

Path

The URL path of the Web Service. The actual name to be called by external applications when using the Web Service.

The URL path requires permissions and should be unique per Path / Version / Response Format / Request Format.

Web Service Permissions: set on the URL with the parameter **token=** and its value. 

For example, two Web Services sharing the same URL path:

  • wsGetCustomerInfo version is set to 1.
  • wsGetCustomerInfoDev version is set to 2.

The path is defined as follows:

http://localhost:3213/api/v1/getCustomerInfo?token=t1&format=json&customerId=543; When the above URL is run it invokes wsGetCustomerInfo. When the URL version is modified from v1 to v2, wsGetCustomerInfoDev is invoked.

Verb

Methods supported by the Web Service, as follows: 

  • GET, get data. 
  • POST, create new data based on the data provided. 
  • PUT, update data. 
  • DELETE, delete data.
  • To select a method, click the dropdown list and enable it. Note that at least one method should be selected.

Is Raw

Indicates whether the output structure should be manipulated automatically by Fabric.

Values are True or False.

Default = False. When True, Fabric brings the data response as is without parsing or formatting the response to be aligned with the Web Service's output format.

Produce

Web Service’s output format.

Default format: JSON

Additional formats: XML and CSV.

To select the format/s, click the dropdown menu and enable them.

Serialize null

If True, display fields with null value in the reponse. Else- ignore fields with null values. The default is True.

Description

Web Service’s description on Swagger.

Result Metadata

Response example to be displayed in Swagger before the Web Service call.

Set example-JSON, example-XML and example-CSV.


How Do I Generate HTML format or legacy JSON/XML ?

To generate these formats, open the Java Logic file and add the following tag above the public class which encapsulates the Web Services defined in the specific Logic category:

```java @legacy public class Logic extends WebServiceUserCode {…}

Then add the UNKNOWN value to the Produce function call in the line where the Web Service is defined: 

java @webService(path = "test/getCustomerInfo", verb = {MethodType.GET, MethodType.POST, MethodType.PUT, MethodType.DELETE}, version = "1", isRaw = false, produce = {Produce.UNKNOWN})

Modify the Properties panel of the Web Service as shown below:



<img src="images/Web-Service-KI-2-1_Produce1.png">



After deploying the Web Service, call it from the browser using the appropriate token, parameter and format.

Example with HTML format:

html http://localhost:3213/api/test/getCustomerInfo?ID=1000&token=tgreg&format=html ``` The response is displayed in the body of the browser's web page:

Previous

Web Service Properties

Fabric Web Services properties include the definitions, methods, categories and essential metadata that contribute to the main functionalities and characteristics of the Web Service.

How Do I Access Web Service Properties?

Go to the Project Tree, right click Web Services and select New Web Service to display the Function Manager window.

drawing

What Are Web Service Properties?

Web Service Properties are located on the top right corner of the Web Service window.

drawing

The following are the Web Services properties:

Property

Description

Name

Name of the assigned Web Service function. The assigned name should be meaningful and should have a ws% prefix.

Category

Characteristics or class of the Web Service. Note that each category has a separate Java file.

Return Type

Type of Output value returned from the Web Service that is displayed in a dropdown list. For example, String, Long, Map, List, Customized Class or Object. Output values in the list can be overridden with new values.  Fabric knows how to serialize complex structures automatically when sent as JSON in the request body.

Version

Representation of the Web Service’s versioning control status. A version is incorporated into the Web Service’s URL and is used to enable several Web Service versions that are all related to the same service. By default, the version is populated by 1.

Versioning Logic 

  • If the version is not part of the URL, the API will respond with the latest version.
  • If the version is part of the URL and the API version exists, the API will respond with the specified version.
  • If the version is part of the URL and the latest API version is lower, the API will respond with the latest version.
  • If the version is part of the URL and is lower than the lowest API version, the API will return the correct error response code.
  • If the version is part of the URL and is in between two API versions, the API will respond with the lower version.

Path

The URL path of the Web Service. The actual name to be called by external applications when using the Web Service.

The URL path requires permissions and should be unique per Path / Version / Response Format / Request Format.

Web Service Permissions: set on the URL with the parameter **token=** and its value. 

For example, two Web Services sharing the same URL path:

  • wsGetCustomerInfo version is set to 1.
  • wsGetCustomerInfoDev version is set to 2.

The path is defined as follows:

http://localhost:3213/api/v1/getCustomerInfo?token=t1&format=json&customerId=543; When the above URL is run it invokes wsGetCustomerInfo. When the URL version is modified from v1 to v2, wsGetCustomerInfoDev is invoked.

Verb

Methods supported by the Web Service, as follows: 

  • GET, get data. 
  • POST, create new data based on the data provided. 
  • PUT, update data. 
  • DELETE, delete data.
  • To select a method, click the dropdown list and enable it. Note that at least one method should be selected.

Is Raw

Indicates whether the output structure should be manipulated automatically by Fabric.

Values are True or False.

Default = False. When True, Fabric brings the data response as is without parsing or formatting the response to be aligned with the Web Service's output format.

Produce

Web Service’s output format.

Default format: JSON

Additional formats: XML and CSV.

To select the format/s, click the dropdown menu and enable them.

Serialize null

If True, display fields with null value in the reponse. Else- ignore fields with null values. The default is True.

Description

Web Service’s description on Swagger.

Result Metadata

Response example to be displayed in Swagger before the Web Service call.

Set example-JSON, example-XML and example-CSV.


How Do I Generate HTML format or legacy JSON/XML ?

To generate these formats, open the Java Logic file and add the following tag above the public class which encapsulates the Web Services defined in the specific Logic category:

```java @legacy public class Logic extends WebServiceUserCode {…}

Then add the UNKNOWN value to the Produce function call in the line where the Web Service is defined: 

java @webService(path = "test/getCustomerInfo", verb = {MethodType.GET, MethodType.POST, MethodType.PUT, MethodType.DELETE}, version = "1", isRaw = false, produce = {Produce.UNKNOWN})

Modify the Properties panel of the Web Service as shown below:



<img src="images/Web-Service-KI-2-1_Produce1.png">



After deploying the Web Service, call it from the browser using the appropriate token, parameter and format.

Example with HTML format:

html http://localhost:3213/api/test/getCustomerInfo?ID=1000&token=tgreg&format=html ``` The response is displayed in the body of the browser's web page:

Previous