Submit and vote on feature ideas.

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.

Insert Value into a soap message

reactancexl
reactancexl Posts: 160

I use a script that creates a Guid and store it in a variable. I have a Data Bank which writes the soap message to a Writeable data Source. What I need to do is to insert the Guid into the body of the soap message before I store in the DS. I tried at the databank level to refer the node to the variable to no avail. What is the best way to do this? thx

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited May 2017

    The XML Transformer has a feature where it can alter values at particular XPaths. Check the "Alter" tab.

    Please also note that any messages configured directly in tool editors, like a SOAP request in a SOAP Client tool, can be parameterized directly without needing to post process the message with an XML Transformer, for example.

    Test suite variables, environment variables, data source columns, and data bank columns can be referenced directly in tool editors with ${variableName} syntax. So, make sure your script is saving your GUID to something like a test suite variable (com.parasoft.api.ScriptingContext.setValue(name, value)).

  • reactancexl
    reactancexl Posts: 160

    I have is the whole message is stored in a column in DS and use the xpath "Entire element". What I need to do is to change the node value within the "Entire element" message. If I use the XML transformer, to ref variables etc it looks like I have to map each individual nodes for the whole message and refer to variable value on the node I want to change while all the others are 1 to 1? Is this a correct assumption?

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    The XML Transformer lets you map nodes in the document, identified by XPath, and chose a replacement value. You don't "map each individual nodes for the whole message" but are only picking XPaths of the nodes you want to modify.