26 September 2007 - 1.7.6 | home user-guide eclipse jbossws intellij netbeans maven 1.X/2.X PDF files forums bugs sourceforge

Home
Getting Started
User Guide

- Overview
  - Tabbed Desktop
  - License Management
  - Preferences
  - XPath Selection
  - Script Library
- Workspaces
- Projects
- Interfaces
  - Interface Viewer
- Operations
- Working with Requests
  - Form Editor
  - Overview View
  - Outline Editor
  - Message Inspectors
  - Attachments/Inline Files
- Functional Testing
  - Getting Started
  - TestSuites
  - TestCases
    - Test Requests
      - Assertions
      - Editor Wizards
    - Property Transfers
    - Conditional Gotos
    - Groovy Scripts
      - Examples
      - GroovyUtils
    - Properties Step
    - Delay Step
    - Mock Response
    - DataSource
    - DataSource Loop
  - Property Expansion
- Load Testing
  - Getting Started
  - Limit & Strategies
  - Execution
  - Assertions
  - Diagrams
  - JMeter comparison
- Mocking
  - Getting Started
  - Mock Services
  - Mock Operations
  - Mock Responses
- Usage Scenarios
  - Data-Driven Testing
  - Template-Driven Testing
  - Interactive Testing
  - Surveillance Testing
- Tool Integrations
  - Code Generation
  - WSDL Generation
  - WS-I Tools
  - Apache Tcp-Mon
- CommandLine Tools
  - TestCaseRunner
  - LoadTestRunner
  - MockServiceRunner
  - ToolRunner
- Keyboard shortcuts

IDE/Tool Plugins
Search soapUI site
Project Documentation

- About soapUI
- Project Info
- Project Reports

## Property Transfers

Property Transfers are TestSteps that transfer properties between TestSteps, each containing an arbitrary number of "transfers" containing a source and destination step and property specification with optional XPath/XQuery expressions. Property Transfers use the same Saxon XPath/XQuery engine as described for the XPath/XQuery Assertion. |

### The PropertyTransfer Editor

The Property Transfer editor is opened by double-clicking a PropertyTransfer step either in the navigator or in the TestCase editors' TestStep-list.

The editor contains a list of configured transfers to the left, selecting a transfer in the list will displays that transfers source and destination XPath/XQuery expressions to the right.

Use the top-right comboboxes to specify the source step/property to be transferred, the target step/property is specified with the combo-boxes in the middle. If the properties contain XML an accompanying XPath expression can be specified to further select the value to transfer from/to. soapUI Pro adds an XPath Selector button to the right of these combo boxes for easily selecting the source/target XPath expression from the selected source/target property.

The following actions are available from the top toolbar

- Add : prompts to add a new transfer to the list
- Delete : prompts to delete the selected transfer
- Copy : prompts to create a copy of the selected transfer
- Rename : prompts to rename the selected transfer
- Run : runs the selected transfer, ie transfers its value as configured specified. For this to work properly the source and target properties must be available (for example a TestRequest response).
- Run All : runs all the transfers, ie transfers the values specified. For this to work properly the source and target properties must be available (for example a TestRequest response).
- Declare : declares namespaces in both the source and destination XPath fields. Namespaces in the source field are extracted from the selected TestRequests current response message, namespaces in the target field are extracted from the subsequent TestRequests request message. If either of these are not available, soapUI will prompt to define all namespaces available in the associated schemas.
- Online Help - Displays this page in an external browser

A "Transfer Log" inspector at the bottom of the editor displays all transfers performed by this PropertyTransfer while the editor has been open, including both those performed using one of the toolbar buttons and those performed during a TestCase/TestSuite run. The Transfer Logs toolbara contains a "Clear" button to clear its current contents.

### Transfer Execution

Upon execution during a TestCase run, each transfer in the Property Transfer is performed by selecting the property specified by the transfers source step, property and optional XPath expression and copying their value(s) to the destination steps specified property using an optional XPath expression.

If XPath expressions are specified, soapUI will try to replace the target node with the source node if they are of the same type. If not (for example when assigning text() to an @attribute), soapUI will do its best to copy the value as possible.

Source and target XPath expressions must both point to existing nodes in their respective properties, the source property obviously requires the node so it can be selected, the target property requires the node so it can be found and overwritten.

If any of the transfers fail due to missing matches of any of the XPath expression, an error is printed and the step will either fail or go on, depending on of the "fail on error" option has been selected for that transfer. TestCase execution is only aborted if the TestCases' "Fail on error" option has been set as described for under TestCase Options.

The following options are available for each transfer:

- Fail transfer on error - Fails the property-transfer if an error occurs (for example a missing source property)
- Set null on missing source - Overides errors for missing source values and sets the target property to null in these cases
- Transfer text content - When the xpath expression point at element nodes, their text content is transferred instead of the elements themselves (required for backward-compatibiliy with soapUI 1.5)
- Ignore empty/missing values - Overrides errors for missing source values and just ignores corresponding transfers
- Transfer to all - If the target XPath expression selects multiple nodes, the source property value will be set in all these nodes instead of only the first one.
- Use XQuery - interprets the specified source XPath expression as an XQuery expression instead, allowing for transfers of complex/transformed data instead of just "plain" copying

### Working with Property Transfers

A Property Transfer can be created as follows:

1. Begin by creating the two TestSteps that the PropertyTransfer should transfer between.
2. Create the PropertyTransfer and first add a transfer in the configuration dialog using the Add button
3. Select the source and target TestStep and property in their respective combo-boxes
4. If any of the properties contains XML, proceed by defining namespaces in the XPath expressions using the Define button, then add the actual XPath expressions that specify what to select and where to copy it. In the screenshot above both expressions are `//ns1:SessionId` which will result in the sessionId element being copied from the preceding response to the following request (where it must be available but preferably empty)
5. Test the transfer(s) by selecting the Run button and check the following request message that the values have been copies correctly. Any errors will be shown either in the main soapUI log (at the bottom) or in a designated popup
6. Repeat steps 3-5 for each transfer added to the ValueTransfer

with soapUI Pro creating property transfers is greatly simplified using the corresponding Response Wizards which perform most of the above steps automatically.

### PropertyTransfer Example

The following sample is also included in the sample project included in the offline distribution:

Set up 2 requests to the Amazon Web Service defined at (http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl);

    <soapenv:Envelope xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2006-02-15"
    	xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
         <ns:ItemSearch>
            <ns:SubscriptionId>- your subscription id here-</ns:SubscriptionId>
            <ns:Request>
               <ns:SearchIndex>Books</ns:SearchIndex>
               <ns:Title>Oxford</ns:Title>
            </ns:Request>
         </ns:ItemSearch>
      </soapenv:Body>
    </soapenv:Envelope>

and

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    	xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2006-02-15">
      <soapenv:Body>
         <ns:ItemSearch>
            <ns:SubscriptionId>- your subscription id here -</ns:SubscriptionId>
            <ns:Request>
               <ns:Author>?</ns:Author>
           <ns:SearchIndex>Books</ns:SearchIndex>
            </ns:Request>
         </ns:ItemSearch>
      </soapenv:Body>
    </soapenv:Envelope>

and then create the following transfer which moves the first author from the first requests "response" property to the `author` request element in the following steps "request" property;

Source XPath:

    declare namespace ns='http://webservices.amazon.com/AWSECommerceService/2006-02-15';
    (//ns:Author)[1]

Target XPath:

    declare namespace ns='http://webservices.amazon.com/AWSECommerceService/2006-02-15';
    (//ns:Author)[1]

Next: Conditional Goto Steps