views:

12

answers:

1

How can I pass in the current datetime parameter to a SOAP request? I know you can pass in parameters by adding a datasource to the web test project and reference it like this {{DataSource.TableName.FieldName}}.

But I want to pass in current datetime parameter as a dynamic value (something like DateTime.Now). How do I go about doing this? Below is sample SOAP request that I put into String Body:

<soap:body>
   <MyQuery xmlns="http://something.com"&gt;
      <req>
         <QueryType>{{DataSource.Table.QueryType}}</QueryType>
         <Name>{{DataSource.Table.Name}}</Name>
         <RequestDateTime>{{insert DateTime.Now here}}</RequestDatetime>
      </req>
   </MyQuery>
</soap:body>

P.S. Running web test by adding Web Service Request in Visual Studio Team System 2008

A: 

Convert it to a coded test. Easy enough to add a Datetime.Now.ToString(format) call.

Nat
Thank you, this is exactly what I was looking for.
Nicholas