方法 : Web サービス要求にデータ バインディングを追加する
このトピックの内容は、次の製品に該当します。
Visual Studio Ultimate |
Visual Studio Premium |
Visual Studio Professional |
Visual Studio Express |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Web サービス要求にデータ バインディングを追加するには、SOAP XML を手動で変更する必要があります。 詳細については、「方法 : Web サービス テストを作成する」を参照してください。
データ バインディングを Web サービス テストに追加するには
Web サービス要求を含む Web パフォーマンス テストを開きます。
Web テスト エディターが表示されます。
要求ツリーで、データ ソースにバインドする Web サービス要求を見つけます。 その下の [文字列ボディ] ノードを選択します。
[プロパティ] ウィンドウで、[文字列ボディ] プロパティの横にある [...] ボタンをクリックします。
[HTTP ボディ文字列の編集] ウィンドウが表示されます。
次の構文を使用して、SOAP 本体の値をデータ バインド値に置き換えます。
{{DataSourceName.TableName.ColumnName}}
たとえば、次のようなコードがあるとします。
<?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>
これを次のように変更できます。
<?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>
[OK] をクリックして [HTTP ボディ文字列の編集] ウィンドウを閉じます。
[ファイル] メニューの [保存] をクリックして、Web パフォーマンス テストを保存します。
参照
処理手順
チュートリアル: Web パフォーマンス テストへのデータ バインドの追加