How to: Add Data Binding to a Web Service Request
To add data binding to a Web service request, you must change the SOAP XML manually. For more information, see How to: Create a Web Service Test.
To add data binding to a Web service test
Open a Web test that contains a Web service request.
The Web Test Editor is displayed.
Find a Web service request in the request tree that you want to bind to a data source. Select the String Body node under it.
In the Properties window, click the ellipsis (…) in the String Body property.
The Edit HTTP Body String window appears.
Replace values in the SOAP body with data bound values by using the following syntax:
{{DataSourceName.TableName.ColumnName}}
For example, if you have the following code:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <CheckStatus xmlns="http://tempuri.org/"> <userName>string</userName> <password>string</password> <orderID>int</orderID> </CheckStatus> </soap:Body> </soap:Envelope>
You can change it to the following:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <CheckStatus xmlns="http://tempuri.org/"> <userName>{{DataSourceName.Users.Name}}</userName> <password>{{DataSourceName.Users.Password}}</password> <orderID>{{DataSourceName.Orders.OrderID}}</orderID> </CheckStatus> </soap:Body> </soap:Envelope>
Click OK to close the Edit HTTP Body String window.
On the File menu, click Save to save the Web test.
See Also
Tasks
Walkthrough: Adding Data Binding to a Web Test