When using a web client function, is there a way to receive the HTTP header details of the HTTP response? The "WebClientLogging" facility does log them, such as Transfer-Encoding: chunked Content-Type: text/xml; charset=utf-8 Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 ... However, the web client funtion will only get the response's body. For a web service, I would use the HTTP_HEADER() function family to get these values from the HTTP request and the HTTP_RESPONSE_HEADER() functions to get this from the created response. But these don't seem to apply for a web client function (and even if they do, I would not know how/where to call them...). (In my case I would be particularly interested in the Content-Type header of a SOAP response.) |
After some more reading and some more testing based on Mark's response from that FAQ, I guess the answer is: No, you can't with a web client function. You do need a web client procedure. Furthermore, the web client procedure cannot use type SOAP:DOC, as that still only returns the SOAP body (and SOAP headers). So I'll guess when trying to get the HTTP response headers of a SOAP request, I have to use a web client procedure of type HTTP:POST (and therefore have to build the SOAP envelope myself), such as create or replace procedure WSP_StartRequestRaw(XmlPayload long nvarchar) result (attribute long varchar, value long varchar) url 'http://...' type 'HTTP:POST:text/xml' header 'SOAPAction:"urn:StartRequest"' set 'HTTP(VERSION=1.1;CHUNK=OFF)'; Then I can access the desired headers as following:
Sigh. I should have better read the docs more carefully - it's documented here, of course, I should add:):
(The last sentence implicitly telling that SOAP procedures do not return the full HTTP response.) |