Loading...
 
B-Fabric Web services

Introduction

B-Fabric provides a Web services interface to create, read, update, and delete data in B-Fabric using a programmatic way. For instance, you can create an application which prints a special list of samples (only with attributes which you consider valuable) which belong to a certain project. Therefore, following solution approaches could be considered (list might not be complete):
  1. You decide not to develop an application, but you hire an employee who creates the list by copying data from the B-Fabric GUI into the document: Well, while this solution approach is mentioned, it is definitely not really considered as such.
  2. You ask B-Fabric developers to implement this functionality in B-Fabric: At the time of writing, this is the default approach. Thereby, development of B-Fabric may become the bottleneck, since there are not so many developers. Furthermore, in order to make the system running with the new functionality, the system has to be restarted.
  3. You create an application which takes the csv-file (which can be generated from the GUI) as input, parses it and creates the properly formatted document. This is more realistic, but still implies to much work: every time you want to create such a list, you need to log into B-Fabric, navigate to the correct page, click on the export button, save the file, wait until the download has completed, start your application with the downloaded file as input... yes, go and get a cup of coffee.
  4. You create an application which connects directly to B-Fabric database and fetches data from there: This is a possibility which is also at least partially utilized, but is still problematic. The business logic is implemented on the application level, not on the database level, so if direct database access is to be granted, then it would be necessary to implement everything on both levels. This is even more complicated in case of performing write operations. Furthermore, connecting to the B-Fabric database would require that a non-standard port would be open (not blocked by the firewall), which is not true if one tries to connect "from outside".
  5. You create an application which utilizes the web services for fetching the required information from B-Fabric and for creating the list: And the winner is... Well, assume that you have created such an application, which sends an HTTP-request to B-Fabric, receives an HTTP-response and processes it appropriately, then every time you would like to create such a list, you just need to run your application (with the correct project id as input), and it will fetch the most current data from B-Fabric and create the list. You do not have to take care of any limitations caused by firewall filtering since you are using a common protocol (HTTP). Your request is treated in the same as requests from the GUI, the same application logic is utilized.
But what does "sending an HTTP-request" mean? B-Fabric web services utilize SOAP protocol: the client program creates an appropriately formatted XML content and sends it as an HTTP POST request to B-Fabric, which parses this XML content, creates a new XML content accordingly and sends this as HTTP POST response. The XML schema of the "request XML content" is defined in WSDL; this information is found in an endpoint, which is simply a URL. This explanation is still too theoretical, so let's have a look at the concrete usage.

[+] soapUI: a Graphical Tool for Exploring Web Services

Web Service Programming

soapUI is a nice graphical tool; but wasn't the idea of web services to allow applications to communicate with B-Fabric? soapUI is considered only for getting an impression of how web services work, but it is not thought to be used for programming other tools. As already mentioned, the whole communication is performed by sending HTTP POST requests and receiving HTTP POST responses, so one only needs to find out how this is to be done with a particular programming language. There might be several ways to do this; in the following sections, some possible ways are shown.
With the current architecture, when the API must be extended, the following classes should be either created or modified. For example if the api for the consumable must be available at at url https://fgcz-bfabric.uzh.ch/bfabric/consumable?wsdl then we have to create the following files:
  • forms/MFConsumable.java
  • webservice/client/SoapClient.java
  • webservice/client/endpoint/EPConsumable.java
  • webservice/client/request/SoapRequestRead.java
  • webservice/client/request/SoapRequestSave.java
  • webservice/request/read/parameters/XMLRequestReadParametersConsumable.java
  • webservice/request/read/parameters/query/XMLRequestReadQueryConsumable.java
  • webservice/request/save/parameters/XMLRequestSaveParametersConsumable.java
  • webservice/request/save/parameters/entity/XMLRequestSaveConsumable.java
  • webservice/response/XMLResponse.java
  • webservice/server/endpoint/APIConsumable.java
  • webservice/server/manager/WSConsumableManager.java
  • xml/entity/XMLConsumable.java

Note that you can list all web service by just using the name of endpoint, e.g.: https://fgcz-bfabric.uzh.ch/bfabric/consumable

[+] Bash

[+] Perl

[+] Python

[+] Java

[+] B-Fabric Shiny

Available Web Services

Currently, all endpoints provide methods in connection to some B-Fabric entity.
Endpoints are available for following entities (in development, list not complete):
In order to use provided web services, you must be granted with at least one of these roles: admin, feeder or application manager.

Note: In you want to perform a contains instead of an exact match in case of string values, please use the percentage symbol around the value. Example:
<description>%rat%</description>



Created by amarko. Last Modification: Friday December 8, 2023 15:53:14 CET by tuerker.