Idhttpserver Realization WebService (130 articles Datasnap)

Source: Internet
Author: User

Friends have a project, the communication protocol uses HTTP, and the data sequence uses bin (binary). He did not know what technical plan to use.

REST WebService is Http+json,soap WebService is http+xml, it seems not suitable.

So I thought of the Tidhttpserver control using Indy to implement. Tidhttpserver can implement WebService middleware.

Limited to space, omitting several codes.

Middleware Code:

Set binding parameters
IdHTTPServer1.Bindings.Clear;
Idhttpserver1.defaultport:= 8000;
IdHTTPServer1.Bindings.Add.IP: = ' 127.0.0.1 ';
Start the server
Idhttpserver1.active: = True;

Procedure Tform1.idhttpserver1commandget (Acontext:tidcontext;
Arequestinfo:tidhttprequestinfo; Aresponseinfo:tidhttpresponseinfo);
Begin
Memo1. Lines.add (arequestinfo.document);
Memo1. Lines.add (Arequestinfo. params.values[' T1 ');
Memo1. Lines.add (Arequestinfo. params.values[' T2 ');
End

IE Browser input: HTTP://127.0.0.1:8000/TEST?T1=CHINA&T2=CXG

Middleware execution:

Above is the method of invoking the middleware through the Get method of HTTP and passing parameters, also, the post of HTTP can.

A few lines, you can achieve a super-invincible simple WebService middleware. I do not know you see, so simple middleware has a flexible place: its data sequence format can be text, JSON, XML, or bin.

http://www.cnblogs.com/hnxxcxg/p/3395524.html------------------------------------------------------------------I modeled this tutorial. The results are not responding, help to see where the problem. Thanks, sir.

You're the one who realized webservice, what's the use, Apache?
You just use Idhttpserver. Then implement a simple HTTP server, embedded an HTML page, you can post data to your server, idhttpserver response to the post message and saved to the current directory is OK

Idhttpserver Realization WebService (130 articles Datasnap)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.