Web services - Design and development of web-applications

Web services

In addition to wcb applications, another important type of software used on the web is web services (web services). They are sets of methods that can be called to execute with specified parameters using HTTP requests, and the results of their execution can be obtained in the form of HTTP responses.

Web services are supported, like web applications, by web servers and intended for use by any program that can generate the correct HTTP requests and understand the received HTTP responses, but not users (people), since they do not have a graphical user interface. Such programs can be web-applications, other web-services or even local applications.

Web-services, as well as web-applications, are fully implemented using technologies and web-standards. They have URLs that can be used to access them. To transmit a request to execute web service methods and return results, the XML language is used. In Fig. 2.4 shows the general scheme of interaction of a web-application with a web-service.

The work of web services is based on the use of data described in the XML language. Such XML data must be compiled in accordance with the Simple Object Access Protocol (SOAP), which provides a standard way of describing messages in XML format. It allows developers to describe what the service can perform, and makes available functionality available to other applications.

The general scheme of interaction of applications with web services

Fig. 2.4. The general scheme of interaction of applications with web-services

An example of a simple web service can be a Math service that includes two operations: Add and Subtract:

public int Add (int x, int y) {return x + y;}

public void Subtract (int x, int y, out int z) {z = x-y; return z;}

XML data generated in accordance with the SOAP protocol as the root element, use the "Envelope" element, which includes two sub-elements - "Header" (optional) and Body & quot ;. In the Header describes general information related to the request or response. And the Body in the query contains information about the method being called (for example: Subtract) and the parameters (x and y) passed to it. The XML document thus generated is transmitted using HTTP or SMTP.

When using HTTP, this XML document (Envelope) is included in the body of the HTTP request, which follows an empty string after the query string (for example, POST/services HTTP/1.1) and the corresponding headers, as shown in Fig. 2.5.

Example of an HTTP request to a web-server using SOAP

Fig. 2.5. Example of an HTTP request to a web-based system using SOAP

Example of an HTTP response from a web-server using SOAP

Fig. 2.6. Example of an HTTP response from a web-server using SOAP

WSDL snippet description of the web-service Math

Fig. 2.7. The WSDL snippet description of the web-system Math

After receiving this request, the web server passes control to the runtime that calls the requested method and passes the parameters to it. After this method is executed, an XML document is created containing the results of the method that is executed in accordance with the SOAP protocol.

In Fig. 2.6 shows an HTTP response containing the results of a web service (Subtract), which performs the subtraction of the values ​​of the first two parameters and returns the result in the third parameter. Since these data are sent in the HTTP response, they are included after the status line and the corresponding headers.

In order for users of services (such as web applications) to correctly write queries and understand answers, web services are also responsible for providing special descriptions written in Web Services Definition Language (WSDL), which also uses XML- format. The WSDL language allows developers to describe the syntax for calling web service methods. Using WSDL, you can describe various web service elements, such as data types (& lt; wsdl: types & gt;), messages (& lt; wsdl: message & gt;), port types (& lt; wsdl: port & gt;), bindings ( & lt; wsdl: binding & gt;) and the service itself (& lt; wsdl: service & gt;).

To receive a WSDL document describing the web service, you need to send it an HTTP request & lt; Service URL & gt;? WSDL. This WSDL document describes everything that the client needs to manage the web service (Figure 2.7).

thematic pictures

Also We Can Offer!

Other services that we offer

If you don’t see the necessary subject, paper type, or topic in our list of available services and examples, don’t worry! We have a number of other academic disciplines to suit the needs of anyone who visits this website looking for help.

How to ...

We made your life easier with putting together a big number of articles and guidelines on how to plan and write different types of assignments (Essay, Research Paper, Dissertation etc)