If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > How to get client IP address in HTTP request (Web services)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-07-09, 05:41
abanic abanic is offline
Registered User
 
Join Date: Feb 2009
Posts: 5
How to get client IP address in HTTP request (Web services)

Hello!
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)
begin
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
from table
where criteria bla bla
;
end;

create service svcDoSomething type 'XML'
authorization off
user dba
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.

Have a nice day
Angello
Reply With Quote
  #2 (permalink)  
Old 11-08-09, 03:07
Derek Asirvadem Derek Asirvadem is offline
Registered User
 
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 258
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
__________________
Regards
Derek Asirvadem (Formerly DerekA)
Information Architect / Senior Sybase DBA
Copyright © 2009 Software Gems Pty Ltd

I answer questions from the Original Poster only. If you have a genuine question, as the moderators have requested, start a new thread.

http://www.softwaregems.com.au
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On