Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2009
    Posts
    5

    Unanswered: 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

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •