Scripting with a value in a XML Databank chained to Request

VirtEyesVirtEyes Posts: 14

I am trying to access a value stored in a XML data bank that is chained to the incoming request. In my extension tool, I chained a XML data bank to see if I can successfully pass the value to the tool.

my code:

function f(input, context){
var id = context.getValue("Generated Data Source","traceId");

return id;

}

My issue is that the data bank is always blank when I run the tests and hit the response. The extension tool is linked as Traffic Object -> Extension tool.

What am I missing here?

Comments

  • jakubiakjakubiak Posts: 563 admin

    When you say the "data bank is always blank", I assume you are referring to the UI for the XML Data Bank when you open the tool? If so, you are correct that the XML Data Bank does not populate with content after you hit a virtual asset. In order to populate it, you need to copy an example payload into the expected content field of the data bank, and then the UI controls will be there to help you define an XPath for extracting an element.

  • VirtEyesVirtEyes Posts: 14

    That is the case i am talking about, the data bank appears to have no traffic or values to extract.
    So is XML data bank the wrong tool to store the value generated from the extension tool?

  • jakubiakjakubiak Posts: 563 admin

    No, it's the right tool - you just need to manually populate the tool with the expected content to make it easier for you to define the XPaths that you need. Once you have the tool configured, it will actually execute when a request is made to the corresponding responder.

  • VirtEyesVirtEyes Posts: 14

    What should I do in the instance that the extension tool sets a value that takes a value from a value in the request, but sets the value of a variable that only exists in the response?

    I have tried your suggestion, but the databank doesn't seem to pass that value from the extension tool to the response

  • williammccuskerwilliammccusker Posts: 211 ✭✭

    Hi,
    I think this case sounds more complicated that we understood it to be. Could you contact [email protected] so that someone can help you directly with your issue?

Sign In or Register to comment.