Thanks Narinder and Julio.

That did it! Evidently the 4D Web Server knows where to send the header without 
being explicitly told. Maybe it has a queue? I guess it doesn’t really matter 
as long as it works.

So it appears that I can use HTTP Client commands for ‘outbound’ REST calls and 
use Web Server commands to respond to ‘inbound’ REST calls. Does that sound 
right?

Thanks again,

Tom

> On Oct 26, 2019, at 02:40, Narinder Chandi via 4D_Tech <[email protected]> 
> wrote:
> 
> Tom,
> 
> A simple minimal example of how to respond would be something like this:
> 
> ARRAY TEXT($aHeaderFields;3)
> ARRAY TEXT($aHeaderValues;3)
> 
> $aHeaderFields{1}:="X-VERSION"
> $aHeaderFields{2}:="X-STATUS"
> $aHeaderFields{3}:="USER-AGENT"
> 
> $aHeaderValues{1}:="HTTP/1.0"
> $aHeaderValues{2}:="200 OK"
> $aHeaderValues{3}:="4D Web Server/v17"
> 
> WEB SET HTTP HEADER($aHeaderFields;$aHeaderValues)
> WEB SEND TEXT("")
> 
> Check out the 4D Web Server docs for more details:
> https://doc.4d.com/4Dv17/4D/17.3/Web-Server.201-4620181.en.html
> 
> Regards,
> Narinder Chandi,
> ToolBox Systems Ltd.
> https://toolbox.systems
> 
> I am available for new consulting opportunities…
> http://4d.1045681.n5.nabble.com/ANN-4D-Developer-Available-td5765443.html
> -- 
> 
> -----Original Message-----
> From: 4D_Tech <[email protected]> on behalf of 4D Tech Mailing 
> List <[email protected]>
> Reply-To: 4D Tech Mailing List <[email protected]>
> Date: Saturday, 26 October 2019 at 04:29
> To: 4D Tech Mailing List <[email protected]>
> Cc: Tom Benedict <[email protected]>
> Subject: Responding to an HTTP Request
> 
>    I’m just starting to do some 4D web development and have a simple question.
> 
>    The 4D app I’m working on needs to respond to a REST call by acknowledging 
> it and sending a status (200 would work). When the REST call comes into the 
> 4D Web Server I handle it in On Web Connection. That part is working fine, 
> but I need to acknowledge receipt so the calling app/service won’t keep 
> retrying. This seems like it should be pretty straightforward, but I’m at a 
> loss to know where to start. I know I need to build a status line and header 
> line, but ‘how’ do I send it? Do I use  some form of HTTP Request? Or do I 
> need to build something with 4DIC? Or something else?
> 
>    If someone could point me to a resource that can enlighten me I’d 
> appreciate it.
> 
>    Thanks,
> 
>    Tom Benedict
> 
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to