Unanswered: How to get client IP address in HTTP request (Web services)
Does anyone know how to get client's IP address in procedure called by web service. Have situation like folowing:
CREATE PROCEDURE DoSomething( list of parameters)
declare sClientIP varchar(20);
// this method do somethnig...selects, updates etc etc...Not importand
// but before I do anythning I'd like to write in log file data about client
// who made this request
set sClientIP = ???????
insert into LogData (ClientIP, SvcName, SvcParams)
values (sClientIP, 'DoSomething', list of params)
// select one or more data from table, view or single value
// and format data in XML (see web service)
select bla bla
where criteria bla bla
create service svcDoSomething type 'XML'
as call DoSomething(list of parameters)
Have try to read HTTP_HEADERS, but there is no any data about client.
So, if anyone have any suggestion I'll be very thankfull.
Not sure about whether the info is directly accessible from Web Services.
However, in ASE, the info is easily accessible. The normal high performance method is to have a set of procs, with "wrappers" if they are accessed from Java or a Web server (not in-line SQL as you have posted, that is s.l.o.w). If you are doing that, it is easy. That is, exec a proc on ASE first, to get the client's IP address. I realise you want the IP address of the client of the web server, not the client of ASE (which is the webserver). You will have to dig around in the web server or Web Services manual. In ASE, just:
select ipaddr from master..sysprocesses where spid = @@spid