RTC Forums
November 01, 2024, 06:35:33 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Help in starting a webserver  (Read 4255 times)
Henk vd Boogaard
RTC Expired
*
Posts: 24


« on: May 17, 2013, 03:41:57 PM »

Hello,
I am new to RTC and I have no experience with web communication.
I am programming in Delphi and have average experience in it.

I hope someone can help me to get started with a project.
I have to make a webserver.
This webserver is addressed (request) with a Call with a XML-file.
The webserver has to check some nodes of the XML-file and the respond by sending a XML-file back The XML-file depends on the information in the request.

I know how to read and write a XML-file.

Can someone please give me a skeleton of a program that is able to read en send a XML-file?

Thanks in advance,
Henk van den Boogaard
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: May 17, 2013, 08:56:05 PM »

Start by reading the following two articles from the RTC Classroom to learn the basics of using RTC components for writing Web Servers:
http://www.realthinclient.com/realthinclient-sdk-demo-1-a-web-server-in-five-minutes/
http://www.realthinclient.com/realthinclient-sdk-sending-dynamically-generated-content/

To read the content body (XML received from the Client), extend the OnDataReceived event of the RtcDataProvider component to use the "Read" method, or the "ReadEx" method on the Sender:TRtcConnection component. In Lesson 2b, the Sender is also accessible through the local rdsServer variable, so you can use this code to get the XML content into a single String variable ...

var
  myXML:RtcString;
begin
...
myXML := rdsServer.Read;
...

RTC components to NOT make a distinction between XML, HTML, CSS, image or binary content. Regardless of the content type you have received, you can always use the Read or ReadEx method inside the OnDataReceived event to read it. And the same goes for sending your content out. Simply use the Write or WriteEx method of the Sender:TRtcConnection component.

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 17 queries.