Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Extracting source IP & values from JSON data bank

Hi,

I'm trying to create a proxy basically scenario is 2 endpoints sending info to single proxy and want to capture what endpoint has sent what data in the data source.

I want to capture source IP and info from JSON data bank in the data source that can be used as a data source correlation for other responders.

Any suggestion? Header data bank does not capture the source IP so trying to figure out how to capture that info

Sujal

Comments

  • OmarR
    OmarR Posts: 235 admin
    edited October 2017

    Good morning Sujadalia,

    You may use the "REST URL Databank" (introduced in 9.10.2) to capture the Host "IP" that is included in the Request. If you do not have the latest version of SoaVirt, you may also use the text databank to isolate and extract the desired information.

    I recommend taking a look at the following discussion:
    https://forums.parasoft.com/discussion/comment/8276#Comment_8276

  • sujaldalia
    sujaldalia Posts: 27

    I'm using 9.10.1 and I don't see "Rest URL Databank" so I will try to upgrade and will update this thread.

    Thanks for your help

    Sujal

  • sujaldalia
    sujaldalia Posts: 27

    Hi Omar,

    I was able to extract the host but that is more of a destination vs the source e.g. If IP-A is sending the request to IP-B and I use "Rest URL Databank" on IP-B and extract host I'm seeing IP-B vs IP-A.

    What am I doing wrong?

  • sujaldalia
    sujaldalia Posts: 27

    This is the sample traffic. I'm interested in extracting this line "Source: 127.0.0.1 - 127.0.0.1"

    Source: 127.0.0.1 - 127.0.0.1
    Destination: http://localhost:9080/SmartProxy_Many_To_One

    POST /SmartProxy_Many_To_One HTTP/1.0
    host: localhost:9080
    content-type: application/json; charset=UTF-8
    content-length: 221

    {"ban":"xxxxxxxxxxxxxxx","lines_of_business":[],"attributes":{"workbench_order_id":"6927276","workbench_customer_id":"7620546","sfdc_opportunity_id":"O-15177701"},"customer_creation_date":"2017-10-18T12:37:21.755-04:00"}

  • OmarR
    OmarR Posts: 235 admin

    Hello,
    Please verify that you are chaining the databank as an output to the incoming transport header in order to capture the "source" details.

  • sujaldalia
    sujaldalia Posts: 27

    I'm adding REST URL Data Bank for the incoming request

  • sujaldalia
    sujaldalia Posts: 27

    So is this a problem and not working as expected or setup issue?

  • OmarR
    OmarR Posts: 235 admin

    I apologize for my confusion. The REST URL databank can capture the details contained in the request including the host where the request is being sent to (destination). However, if you wish to capture the IP of the machine where the request originated from, the IP information needs to be included as part of the request.

    Currently, the easiest option would be include the IP as a custom header in the request so that you may extract it in the responder. The event details log contains the source/destination information, but I am not aware of how to access this information at the responder level.