Additional information for specific topics can be found here.
This chapter provides an overview of how to write your own web services with Fabasoft app.ducx.
Basically, there are two ways to create a new web service:
Creating a web service with a new instance of WebServiceDefinition is the recommended way. You just have to implement a use case and then expose it via a WebServiceDefinition.
Example |
instance WebServiceDefinition MyWebServices { |
You can call the web service via the following URL:
https://<host>/<vdir>/wsjson/MYDEMOAPP_111_100_MyWebServices/MyOperation
Extending the WebServiceConfiguration is not as simple as creating a WebServiceDefintion but it allows you to control the input and output handling or creation of RESTful web services.
The following example shows a configuration of a web service:
Example |
extend instance FSCOWS@1.1001:WebServiceConfiguration { |
You can call the web service with the following URL:
https://<host>/<vdir>/mywebservice
If you are not familiar with the REST architecture please check out this Wikipedia article: http://de.wikipedia.org/wiki/Representational_State_Transfer
Basically, you can put this architecture into practice by extending the WebServiceConfiguration by adding the typical REST HTTP verbs (we call it friendlyurlallowedmethods):
Example |
extend instance FSCOWS@1.1001:WebServiceConfiguration { |
Now you have to create the concrete web service:
Example |
public MyWebserviceAction () { if (#TV.TV_FRIENDLYURL_INCOMING_METHOD == “GET”) { /* your code */ } |
If you are not familiar with JSONP, consult: http://en.wikipedia.org/wiki/JSONP. Basically, all web services defined by WebServiceDefinition support JSONP.
You can set the JSONP parameter in GET requests. The parameter contains the name of the callback function that should be executed when the web service has finished.
Example |
https://at.cloud.fabasoft.com/folio/wsjson/FSCTEAMROOM_1_1001_TeamRoomWebService/TeamRoomInvitations?jsonp=myCallbackFunction This returns: myCallbackFunction({"results":0,"invitations":null}) |
Note that by using JSONP you are limited to GET requests, since this technique only includes an “external” script and you cannot “include” a script, for example with a POST request. Parameters can therefore not be passed within the request body, but only in the URL.
With app.ducx you can perform an HTTP request to gather information, for example from external web services.
Example |
usecase DoHttpRequest() { |
Fabasoft app.ducx allows you to import an OpenAPI service definition into your Fabasoft app.ducx project via an import wizard using “File” > “Import”. In the category “Fabasoft app.ducx” you will find an item called “OpenAPI Specification into Fabasoft app.ducx Project”.
On the next page, you have to select an OpenAPI specification in yaml format.
By finishing this dialog, an OpenAPI server definition will be transformed into the necessary types for a server class and an implementation template to implement the server with Fabasoft app.ducx expression code.
Note: The generated code contains a reference to the imported file so it is recommended to have the imported specification in the resources folder of the project.
The following table shows object classes that do not require a multilingual string.
Object Class | Domain-Specific Construct |
COOAR@1.1:ActiveReport_Text | ActiveReport_Text |
COOAR@1.1:ActiveReport_Web | ActiveReport_Web |
COOAR@1.1:ActiveReportingAction | ActiveReportingAction |
COOAR@1.1:ContentEvaluationAction | ContentEvaluationAction |
COOATTREDIT@1.1:ButtonAction | ButtonAction |
COOATTREDIT@1.1:DeskForm | deskform |
COOATTREDIT@1.1:DisplayItem | DisplayItem |
COOATTREDIT@1.1:FormPage | formpage |
COOATTREDIT@1.1:ObjectEditForm | ObjectEditForm |
COODESK@1.1:MenuRoot | menuroot |
FSCCALDAV@1.1001:VTimezone | VTimezone |
FSCOWS@1.1001:SOAPAction | SOAPAction |
FSCVAPP@1.1001:Application | Application or automatically generated reference by a menu usecase |
COOSYSTEM@1.1:Action | <action reference> |
COOSYSTEM@1.1:MethodDefinition | MethodDefinition |
COOSYSTEM@1.1:Prototype | Prototype |
COOSYSTEM@1.1:UseCase | usecase |
COOSYSTEM@1.1:TypeAggregateDef | struct |
COOSYSTEM@1.1:TypeEnumDef | enum |
COOSYSTEM@1.1:TypeCustomizationPointDef | <customization definition reference> |
COOXML@1.1:XMLSchema | XMLSchema |
FSCOWS@1.1001:WebServiceDefinition | WebServiceDefinition |