Adding HTTP Headers to a Web Service Request
The Web Service Generator generates a proxy that has default HTTP options. These options work for most Web Service access scenarios. But you can also customize the HTTP request with custom HTTP headers.
To do this use the .NET Proxy's AddHttpHeader() method which lets you add custom HTTP headers. Note that this method exists on the .NET proxy, not on the FoxPro proxy so the syntax.
Here's an example that sets the Connection and Keep-alive headers explicitly:
*** Create FoxPro Proxy
loProxy = CREATEOBJECT("MyWebProxy")
loProxy.oService.AddHttpHeader("Connection","close")
loResult = loProxy.ServiceMethod(parm1)
Note that if you make multiple requests on the same proxy the headers are maintained between requests. This is usually desirable, but if you need to clear the headers you can explicitly call:
loProxy.oService.ClearHttpHeaders()
to clear out all headers before setting new ones.
See also
ProxyWrapper.AddHttpHeader | Class ProxyWrapper© West Wind Technologies, 2004-2020 • Updated: 02/09/18
Comment or report problem with topic