This is an introduction to the development of Web Services with the Genero Web Services Extension. It is intended to help those who are using Genero Web Services Extension for the first time to understand the basic Web Services concepts, and to quickly start their development with the Genero tools.
Summary:
Web services are a standard way of communicating between applications over the Internet or the Intranet. They define how to communicate between two entities:
A server that exposes services
A client that consumes the services
For example, a server could expose a "StockQuotation" service that responds to an operation "getQuote". For the "getQuote" operation, the input message is a stock symbol as a string, and the output message is a stock value as a decimal number.
The "getQuote" operation could be a BDL function published on the server :
01
FUNCTION getQuote( stockSymbol )02
DEFINE03
stockSymbol VARCHAR(16),04
stockValue DECIMAL(16,2)05
06
# … Function body07
08
RETURN stockValue09
END FUNCTION
Note: This is not the actual code to write for the server. See Writing a Server function.
On the client side, the Web service client application will be able to call this function just as if it were a local function:
01
LET svalue = WebService_StockQuotation_getQuote( "MyCompany" )
Web services are platform-independent and programming language-independent. The World Wide Web consortium defines the Web services standards. For more information about these standards, you can check the "Web services" section of their web site at http://www.w3.org.
The standards involved in what is commonly called "Web services" are:
XML (Extensible Markup Language) defines a machine-independent way of exchanging data. For example, an XML representation of the following BDL data structure:
01
DEFINE Person02
RECORD03
FirstName VARCHAR(32),04
LastName VARCHAR(32),05
Age INTEGER06
END RECORD
could be:
01
<Person>02
<FirstName>John</FirstName>03
<LastName>Smith</LastName>04
<Age>35</Age>05
</Person>
XML Schema describes the structure of an XML document. For example, for the above document, the schema could say that the XML document contains an element "Person", and that each "Person" contains one and only one element "FirstName", "LastName", "Age". Also, the types of these elements can be defined.
XML Schema allows checking the correctness of an XML document.
SOAP (Simple Object Access Protocol) is the high-level communication protocol between the server and the client. It defines the XML data flow between the server and the client. The "StockQuote" service mentioned in the Concepts section will exchange messages using the following syntax:
Request
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getQuote> <stockSymbol>MyCompany</stockSymbol> </getQuote> </soap:Body> </soap:Envelope>
Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getQuoteResponse> <stockValue>999.99</stockValue> </getQuoteResponse> </soap:Body> </soap:Envelope>
SOAP relies on a lower level protocol for the transport layer.
Web services use SOAP over HTTP.
The WSDL ( Web Services Description Language) describes the services offered by a server. It contains:
A WSDL description is sufficient to get all the information required to communicate with the SOAP server.
HTTP (Hypertext Transfer Protocol) is the set of rules for exchanging files (text, graphic images, sound, video, and other multimedia files) on the World Wide Web.