I am consuming external webservices from my SQL-Anywhere 17 and I am interested in the HTTPSTATUS 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)! I tried to write something like this, but I get always an empty string in my @ResponseStatus variable!
On the other side, I can see this HTTP Response in the WebClientLogFile (as HTTP/1.0 200 OK). Could please somebody tell me Where I am doing mistake? |
You need to use a web client procedure (instead of a web client function) to have access to the full response, web client functions just return the response's body. Thank you very much. It has worked even with the parameter substitution
(05 May '20, 07:42)
Baron
Replies hidden
One more question, how can I then get both "body" and "Status" using one single call? In the mentioned example how can I merge those both calls in one call: SELECT "value" FROM SAPWebPage() WITH (Attribute LONG VARCHAR, Value LONG VARCHAR, Instance INT) WHERE Attribute = 'Status'; SELECT "value" FROM SAPWebPage() WITH (Attribute LONG VARCHAR, Value LONG VARCHAR, Instance INT) WHERE Attribute = 'body';
(05 May '20, 07:56)
Baron
1
You mean, get those values
For the 1. you can use a PIVOT clause: 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 For the second, you would obviously just do something like: SELECT "attribute", "value" FROM SAPWebPage() WITH (Attribute LONG VARCHAR, Value LONG VARCHAR, Instance INT) WHERE "attribute" in ('Status', 'Body')
(05 May '20, 08:07)
Volker Barth
Thanks, I was meaning the first one (with this MAGIC Clause PIVOT) ¯_(ツ)_/¯
(05 May '20, 08:36)
Baron
|