<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: retrieving header values of web client function in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820701#M4851544</link>
    <description>&lt;P&gt;One more question, how can I then get both "body" and "Status" using one single call?&lt;/P&gt;
&lt;P&gt;In the mentioned example how can I merge those both calls in one call:&lt;/P&gt;
&lt;P&gt;SELECT "value"  FROM SAPWebPage() WITH (Attribute LONG VARCHAR, Value LONG VARCHAR, Instance INT) WHERE Attribute = 'Status';&lt;/P&gt;
&lt;P&gt;SELECT "value"  FROM SAPWebPage() WITH (Attribute LONG VARCHAR, Value LONG VARCHAR, Instance INT) WHERE Attribute = 'body';&lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2020 07:56:11 GMT</pubDate>
    <dc:creator>Baron</dc:creator>
    <dc:date>2020-05-05T07:56:11Z</dc:date>
    <item>
      <title>retrieving header values of web client function</title>
      <link>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaq-p/13820698</link>
      <description>&lt;P&gt;I am consuming external webservices from my &lt;STRONG&gt;SQL-Anywhere 17&lt;/STRONG&gt; and I am interested in the &lt;STRONG&gt;HTTPSTATUS&lt;/STRONG&gt; of the response more than the body itself, so I want just to check if the call to the webservice has succeeded (i.e. whether I got 200 OK as HTTP Status)!&lt;/P&gt;
&lt;P&gt;I tried to write something like this, but I get always an empty string in my &lt;STRONG&gt;@ResponseStatus&lt;/STRONG&gt; variable!&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;create or replace function UpdateAPI(EndPoint varchar(200), UserName varchar(200), PWD varchar(200), PayLoad long varchar)&lt;/P&gt;
&lt;P&gt;returns long varchar&lt;/P&gt;
&lt;P&gt;url 'http://!UserName:!PWD@!EndPoint'&lt;/P&gt;
&lt;P&gt;type 'http:put:application/json';&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;begin&lt;/P&gt;
&lt;P&gt;declare @ResponseBody long varchar;&lt;/P&gt;
&lt;P&gt;declare @ResponseStatus long varchar;&lt;/P&gt;
&lt;P&gt;set @ResponseBody = WC_UpdateAPI(@Endpoint, @username, &lt;A href="http://sqlanywhere-forum.sap.com/users/2210/pwd-claudio" target="_blank"&gt;@pwd&lt;/A&gt;, @PayLoad); &lt;/P&gt;
&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;&lt;/SPAN&gt;set @ResponseStatus = HTTP_RESPONSE_HEADER('@HttpStatus');

select @ResponseBody, @ResponseStatus;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;end;
&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;On the other side, I can see this HTTP Response in the WebClientLogFile (as HTTP/1.0 200 OK).&lt;/P&gt;
&lt;P&gt;Could please somebody tell me Where I am doing mistake?&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 04:30:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaq-p/13820698</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2020-05-05T04:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving header values of web client function</title>
      <link>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820699#M4851542</link>
      <description>&lt;P&gt;You need to use a &lt;STRONG&gt;web client procedure&lt;/STRONG&gt; (instead of a &lt;STRONG&gt;web client function&lt;/STRONG&gt;) to have access to the full response, web client functions just return the response's body.&lt;/P&gt;
&lt;P&gt;See &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/3be20d8f6c5f101498b4f893ce16fb11.html"&gt;here&lt;/A&gt; and &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/3be25cc96c5f10148d5def8d7421730c.html"&gt;here&lt;/A&gt; for details.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 04:46:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820699#M4851542</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2020-05-05T04:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving header values of web client function</title>
      <link>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820700#M4851543</link>
      <description>&lt;P&gt;Thank you very much.
It has worked even with the &lt;STRONG&gt;parameter substitution&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 07:42:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820700#M4851543</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2020-05-05T07:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving header values of web client function</title>
      <link>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820701#M4851544</link>
      <description>&lt;P&gt;One more question, how can I then get both "body" and "Status" using one single call?&lt;/P&gt;
&lt;P&gt;In the mentioned example how can I merge those both calls in one call:&lt;/P&gt;
&lt;P&gt;SELECT "value"  FROM SAPWebPage() WITH (Attribute LONG VARCHAR, Value LONG VARCHAR, Instance INT) WHERE Attribute = 'Status';&lt;/P&gt;
&lt;P&gt;SELECT "value"  FROM SAPWebPage() WITH (Attribute LONG VARCHAR, Value LONG VARCHAR, Instance INT) WHERE Attribute = 'body';&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 07:56:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820701#M4851544</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2020-05-05T07:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving header values of web client function</title>
      <link>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820702#M4851545</link>
      <description>&lt;P&gt;You mean, get those values&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;as two columns within one row or&lt;/LI&gt;
&lt;LI&gt;within two rows?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;For the 1. you can use a PIVOT clause:&lt;/P&gt;
&lt;PRE&gt;SELECT "'Status'" AS STATUS, "'Body'" AS Body
FROM
   (SELECT "attribute", "value"
    FROM SAPWebPage() 
       WITH (Attribute LONG VARCHAR, Value LONG VARCHAR, Instance INT)) ST
   PIVOT (min("value") FOR "attribute" in ('Status', 'Body')) PT
&lt;/PRE&gt;

&lt;P&gt;For the second, you would obviously just do something like:&lt;/P&gt;
&lt;PRE&gt;SELECT "attribute", "value"
FROM SAPWebPage() 
   WITH (Attribute LONG VARCHAR, Value LONG VARCHAR, Instance INT)
WHERE "attribute" in ('Status', 'Body')&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 May 2020 08:07:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820702#M4851545</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2020-05-05T08:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving header values of web client function</title>
      <link>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820703#M4851546</link>
      <description>&lt;P&gt;Thanks, I was meaning the first one (with this MAGIC Clause &lt;STRONG&gt;PIVOT&lt;/STRONG&gt;) &lt;/P&gt;
&lt;P&gt;¯_(ツ)_/¯&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 08:36:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/retrieving-header-values-of-web-client-function/qaa-p/13820703#M4851546</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2020-05-05T08:36:42Z</dc:date>
    </item>
  </channel>
</rss>

