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.
Idhttpserver Implementation WebService