Import a Web Application service

Relevant for: API testing only

This topic describes how to import a Web Application service.

Prerequisite

Before importing, study the structure of your WADL document, as specific elements from the document are imported into the WADL hierarchy inside UFT One.

<?xml version="1.0" encoding="utf-8" ?>
<application xmlns="http://wadl.dev.java.net/2009/02">
  <resources base="http://example.com/api">
    <resource path="books">
      <method name="GET"/>
      <resource path="{bookId}">
        <param required="true" style="template" name="bookId"/>
        <method name="GET"/>
        <method name="DELETE"/>
        <resource path="reviews">
          <method name="GET">
            <request>
              <param name="page" required="false" default="1" style="query"/>
              <param name="size" required="false" default="20" style="query"/>
            </request>
          </method>
		  <resource path="{index}">
			<method name="GET" id="get index"/>
			<param name="index" style="template"/>
		  </resource>
        </resource>
      </resource>
    </resource>
    <resource path="readers">
      <method name="GET"/>
    </resource>
  </resources>
</application>

For details on WADL elements, see http://www.w3.org/Submission/wadl/.

Back to top

Import the WADL document

  1. In the toolbar, click on the Add REST Service button and select Import WADL from File or Import WADL from URL or select Tools > Add REST Service > Import WADL from File or Import WADL from URL.

  2. Do one of the following:

    • In the Choose WADL file dialog box, navigate to the directory in which the WADL is saved, and select the WADL file.

    • In the Import WADL from URL dialog box, enter the URL for the WADL or click Browse and search for the URL.

The WADL service is imported to the Local Activities node of your test with its resources and methods. The WADL service, resource, and method hierarchy is created based on the XML description provided in the WADL file, described below:

XML Element UFT One WADL Activity Hierarchy Element
doc xml:lang="en" title="RestService" WADL service name
resource path="<resource name>"

WADL resource

If multiple resources have the same name, UFT One numbers the resources sequentially to differentiate between resources.

method name="<method name>"

WADL method

  • UFT One assigns the WADL hierarchy name using the following criteria:

    If a method name has an "id" attribute, the name is taken from the value of the "id" attribute.

    If a method name does not a have an "id" attribute, then the name is defined as the value of the "method name". For example, if the "method name" is defined as <"method name="GET"/>, UFT One defines the method name in the WADL hierarchy as GET Method.

    The method name always contains the HTTP method as part of its value. This method (GET, POST, PUT, DELETE, TRACE, OPTIONS, or HEAD is also used as the HTTP method in the HTTP tab of the WADL service. For details on the HTTP tab, see HTTP Tab (Properties Pane - API Testing)

    If there are multiple methods of the same name using the default values, then the methods are defined with increasing sequential numbers.

param name="<parameter name>"

WADL resource or method parameters. These parameters are displayed until the Custom Input/Checkpoints tab in the Edit REST Service dialog and in Input/Checkpoints tab for methods on the canvas.

If a "param name = <name>" string also contains a "default=<value>" string, the value defined in the XML is displayed with the parameter.

resources base="http://example.com/api"

WADL Service URL. This is displayed on the HTTP tab for the service.

The URL is also passed to all resources and methods included in the service. For details, see Pass REST service properties.

You cannot change the URL property for an individual resource or method.

Back to top