Networking/de

From Free Pascal wiki
Revision as of 12:55, 20 November 2005 by Swen (talk | contribs)
Jump to navigationJump to search

Deutsch (de) English (en) español (es) français (fr) 日本語 (ja) 한국어 (ko) polski (pl) português (pt) русский (ru) slovenčina (sk) 中文(中国大陆)‎ (zh_CN)

Diese Seite wird der Anfang sein für Tutorials mit Bezug auf die Netzwerkprogrammierung mit Lazarus. Ich bin kein Experte für die Netzwerkprogrammierung und ich werde es diesem Artikel hinzufügen, sobald ich darüber gelernt habe. Ich lade andere ein, um beim Erstellen von Netzwerkartikeln zu helfen. Fügen sie einfach einen Link zum nächsten Abschnitt hinzu, fügen sie eine Seite hinzu und erstellen sie ihren eigenen WiKi Artikel. Auf dieser Seite werden einige allgemeine Informationen zur Verfügung gestellt.

Andere Netzwerk Tutorials

  • Sockets - TCP/IP Socket Komponenten

TCP/IP Protokoll

XML

The Extensible Markup Language is a W3C recommended language created to interchange information between different systems. It is a text based way to store information. Modern data interchange languages such as XHTML, as well as most WebServices technologies, are based on XML.

Currently there is a set of units that provides support for XML on Lazarus. These units are called "XMLRead", "XMLWrite" and "DOM" and they are part of the Free Component Library (FCL) from the Free Pascal Compiler. The FCL is already on the default search path for the compiler on Lazarus, so you only need to add the units to your uses clause in order to get XML support. The FCL is not documented currently (October / 2005), so this short tutorial aims at introducing XML access using those units.

The XML DOM (Document Object Model) is a set of standarized objects that provide a similar interface for the use of XML on different languages and systems. The standard only specifies the methods, properties and other interface parts of the object, leaving the implementation free for different languages. The FCL currently supports fully the DOM 1.0.

Basic Example

Let´s say you want to access a XML file called 'C:\Programas\teste.xml'. Here is the file content:

<?xml version="1.0"?>
<images directory="mydir">
 <imageNode URL="graphic.jpg" title="">
   <Peca DestinoX="0" DestinoY="0">Pecacastelo.jpg1.swf</Peca>
   <Peca DestinoX="0" DestinoY="86">Pecacastelo.jpg2.swf</Peca>
 </imageNode>
</images>

The following code can write the Node´s names to a TMemo placed on a form:

var
 Documento: TXMLDocument;
 i, j: Integer;
begin
 Documento := TXMLDocument.Create;
 ReadXMLFile(Documento, 'C:\Programas\teste.xml');
 Memo.Lines.Clear;
 with Documento.DocumentElement.ChildNodes do
 begin
   for i := 0 to (Count - 1) do
   begin
     Memo.Lines.Add(Item[i].NodeName + ' ' + Item[i].NodeValue);
     for j := 0 to (Item[i].ChildNodes.Count - 1) do
     begin
       Memo.Lines.Add(Item[i].ChildNodes.Item[j].NodeName + ' '
        + Item[i].ChildNodes.Item[j].NodeValue);
     end;
   end;
 end;
 Documento.Free;
end;

WebServices

According to the W3C a Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface that is described in a machine-processable format such as WSDL. Other systems interact with the Web service in a manner prescribed by its interface using messages, which may be enclosed in a SOAP envelope, or follow a REST approach. These messages are typically conveyed using HTTP, and are normally comprised of XML in conjunction with other Web-related standards. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer. This interoperability (e.g., between Windows and Linux applications) is due to the use of open standards. OASIS and the W3C are the primary committees responsible for the architecture and standardization of web services. To improve interoperability between web service implementations, the WS-I organisation has been developing a series of profiles to further define the standards involved.