4D v13.4

Introduction

Home

 
4D v13.4
Introduction

Introduction  


 

A Web Service is a set of functions grouped together as an entity and published on a network. These functions can be called and used by any application compatible with Web Services and connected to the same network. Naturally, Web Services are intended to be used to their fullest in the context of publishing on the Internet. 

Web Services can carry out all types of tasks, such as supervising the routing of packages at a transporter’s, e-commerce, monitoring market values, and so on. 

The program publishing the services is called the “server.” Any application compatible with Web Services can thus use one or more of these functions; this is the “client” program.
The advantage of Web Services is their interoperability with different information systems: it is not necessary for the server and client programs to be mutually compatible in order for the system to work. From the client application point of view, a Web Service is a “black box”: values are sent to it and other values resulting from processing are returned. 

The Web Services proposed by the server can be either public or private. There are a great number of public Web Services on the Internet that any application can solicit free of charge. 

Maintained by the W3C (World Wide Web Consortium, the regulating authority of the Internet) and major firms of the computer industry, Web Services represent a reliable, lasting and upgradable connectivity solution.

Web Services transit essentially using the HTTP transport protocol.

  • SOAP: Web Services use an “open” high-level communication protocol named SOAP (Simple Object Access Protocol). This protocol is based entirely on the XML language, both at the level of the message structure (envelope) and that of the exchanged data. The operation of this protocol is defined by the RFCs (Request for Comment, documents standardizing the various aspects of the Internet), which guarantee it widespread compatibility.
    The operation of a Web Service is as follows: A Web Service client sends a request in XML to the server via the SOAP protocol. The server analyzes the request, carries out the requested operation, and returns its response using the same protocol and language.
  • WSDL: The servers of Web Services generally publish a WSDL (Web Service Description Language) in order to define access specifications for the services being offered. The WSDL enables servers of Web Services to publish the “operating instructions” of the services offered (URLs, lists of methods, parameters, etc.) and comes in the form of an XML file, generally created by the server application itself. This file is not mandatory. 
  • UDDI:The UDDI (Universal Description Discovery and Integration) is a worldwide database that inventories all the public Web Services. Note that it is not mandatory to make a Web Service public and in most cases this will not be necessary.

4D can be used as a Web Services server and/or client. Integration of Web Services into 4D is simple and secure: several configurations enable precise monitoring of publication and subscription conditions.

You can decide to publish any project method as a Web Service, without any major modification. Publication is a method property:

Note: The publication of Web Services with 4D requires a specific license: the SOAP license.

The 4D Web server automatically handles the management of the service as well as the publication and maintenance of the WSDL file. Parsing the XML content of requests, parameter formatting, sending of results, etc., are performed by 4D without any specific programming being necessary.

However, if you want to customize request processing, you can use the specific 4D language commands — refer to the Web Services (Server) section in the 4D Language Reference manual.

Your databases can use any type of Web Service offered on the Internet or on your network. Most of the time, the Web Services Wizard will enable you to use any Web Service instantly, with a minimum of programming:

Using a Web Service in 4D consists in sending requests over the network and retrieving a response. “Proxy” methods are in charge of these operations. The creation of proxy methods for calling Web Services is entirely automatic and can be performed without programming. Simply call these methods in your code.

It is possible to customize these methods using 4D language commands, in the same way as for the server part (see Web Services (Client)).

Web Services published by 4D inherit security mechanisms set up for the 4D Web server. Web Services requests thus benefit from the same configurations as conventional Web requests: passwords, On Web Authentication and On Web Connection database methods, use of the SSL protocol, etc.

In addition, specific configurations (for example, SOAP Get info and SOAP Request commands) allow precise control of Web Service publication.

On the client side, connection to Web Services servers can be carried out in secure mode using SSL. The WEB SERVICE AUTHENTICATE command also allows connection to servers and/or proxies that require authentication.

The communication layer of Web Services (ensuring transport, calling of services and security of exchanges) can operate in two different modes: RPC (Remote Procedure Call) mode and DOC (Message/Document) mode. The difference between these modes lies at the building level of requests and responses for the server and client. The DOC mode is required by certain client applications. 

4D supports the RPC and the DOC mode:

  • Client side, this support is transparent via the Web Services Wizard. The code generated is automatically adapted to the publication mode.
  • Server side, this support is also transparent: the methods are automatically published as Web Services in DOC mode and in RPC mode. The mode choice is carried out via the URL of the WSDL (see Generation of the WSDL).
    • To publish a 4D Web Service in RPC mode, you just need to use the following URL for the WSDL:
      http://ServerAddress/4DWSDL
      The 4D server handles the processing of the requests and responses in RPC. RPC requests are automatically sent to the following address: http://ServerAddress/4DSOAP.
    • To publish a 4D Web Service in DOC mode, you simply need to use the following URL for the WSDL:
      http://ServerAddress/4DWSDL/DOC
      The 4D server handles the processing of the requests and responses in DOC. DOC requests are automatically sent to the following address http://ServerAddress/4DSOAP/DOC

Two different types of XML data are exchanged via the SOAP protocol: simple types and complex types. The data of Web Services published in RPC mode can be of either type. Conversely, the data of Web Services published in DOC mode are systematically of the complex type. 4D supports Web Services using simple and complex type data. 

Complex type XML data cannot be used directly in a 4D database and require specific processing. In many of these cases, the Web Services Wizard will carry out this processing for you; however, it may sometimes be necessary to complete this processing using 4D XML language commands. For more information about this, refer to Processing complex types.

The Web services page of the Database Settings (“Web” theme) sets the general parameters concerning the publication and use of Web Services:

The action of these parameters are described in the following pages. For a more detailed description of each option, refer to the Web/Web Services page section.

 
PROPERTIES 

Product: 4D
Theme: Publication and use of Web Services