Maximo

 View Only
  • 1.  Capture client IP address coming through OSLC call at mbo level

    Posted Thu April 18, 2024 02:14 AM
    Edited by Suhas Joshi Fri April 19, 2024 10:39 AM

    Hi,

    We have a requirement where we have lot of OSLC calls coming to Maximo (GET, POST etc.). When these calls come, we want to capture the IP address of the sender sending these OSLC calls at mbo level. e.g. If the OSLC call is for WORKORDER GET/POST, we want to capture the IP address at WORKORDER mbo level OR object structure script/class (in a class or automation script). Is it doable and has anybody done that? Please provide any pointers.

    To give More information on this, I tried using ctx.getUserInfo().getClientAddr() in the OSIN script but it is returning null value. We are trying in dev environment where there is no load balancer so I assume x-forwarded-for may not help here. All these OSLC calls are coming from another web app where Maximo is backend server.

    Thanks,

    Suhas

    #IBMMaximo 

    ------------------------------
    Suhas Joshi
    Pune
    ------------------------------



  • 2.  RE: Capture client IP address coming through OSLC call at mbo level

    Posted Fri April 19, 2024 05:30 PM

    Hi Suhas,

    Did you check in the log with DEBUG level for your OSLC/REST calls?

    Also, request is entering thru your LB or Firewall, can they help you?

    -Sanjay



    ------------------------------
    SANJAY PATIL
    ------------------------------



  • 3.  RE: Capture client IP address coming through OSLC call at mbo level

    Posted Tue April 23, 2024 03:36 AM

    Hi Sanjay,

    Changing log level to DEBUG did not help and we do not have load balancer configuration in lower environment. Any other way to capture IP address?



    ------------------------------
    Suhas Joshi
    Pune
    ------------------------------



  • 4.  RE: Capture client IP address coming through OSLC call at mbo level

    Posted Tue April 23, 2024 07:39 AM
    Edited by Suhas Joshi Tue April 23, 2024 10:12 AM

    An update to this issue, I was able to retrieve the IP address using below code in OSIN script.

    ctx.getData().getJsonRequest().getHeader("X-Forwarded-For").

    This works fine for POST requests. Next challenge is, for the GET request I am trying to use OSOUT script but ctx.getData() does not work in OSOUT since it is a get call and there is no request json as such. So do I retrive the request data OR headers in GET calls?

    Also, another issue is since this solution is API based, if I have 100 APIs, I will have to write this code in 100 OSIN scripts. Do we have any generic place where I could write this logic and it works for all APIS?

    ------------------------------
    Suhas Joshi
    Pune
    ------------------------------