The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

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.)

asked 12 Feb '16, 03:32

Volker%20Barth's gravatar image

Volker Barth
accept rate: 32%

edited 12 Feb '16, 04:11

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"'

Then I can access the desired headers as following:

select * from dbo.WSP_StartRequestRaw(xmlSoapEnvelope)
where attribute = 'Content-Type';


I should have better read the docs more carefully - it's documented here, of course, I should add:):

Variables accessed from result sets
Web service client calls can be made with stored functions or procedures. If made from a function, the return type must be of a character data type, such as CHAR, VARCHAR, or LONG VARCHAR. The body of the HTTP response is the returned value. No header information is included. Additional information about the request, including the HTTP status information, is returned by procedures. So, procedures are preferred when access to additional information is desired.

SOAP procedures
The response from a SOAP function is an XML document that contains the SOAP response.

(The last sentence implicitly telling that SOAP procedures do not return the full HTTP response.)

permanent link

answered 12 Feb '16, 04:09

Volker%20Barth's gravatar image

Volker Barth
accept rate: 32%

edited 12 Feb '16, 04:36

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 12 Feb '16, 03:32

question was seen: 283 times

last updated: 12 Feb '16, 04:36