Skip to main content

Managing Web Services in Eggplant Performance Studio

Eggplant Performance provides you the option to run performance tests against various types of web services:

  • Simple Object Access Protocol (SOAP): This web service is defined using Web Service Definition Language (WSDL).
  • Representational State Transfer (REST): This web service is defined using OpenAPI (Swagger) specifications.

You add the web service in Eggplant Performance Studio by specifying its definition file (WSDL or OpenAPI YAML/JSON), then generating code from the definition. You can choose to generate the code in either Java or C# programming languages.

After you add the web service to your workspace, you can generate a sample test script for it and then modify the script the way you want and use it for your tests. You could also use the script to add data to the system during a test, or you could use it for functional testing of the service. Instructions for web service tasks are provided below.

Creating a Web Service (SOAP)

Eggplant Performance Studio provides the Create a Service wizard to make it easy for you to create a web service from a Web Service Definition Language (WSDL) file. Below is a discussion of the software you need to create a web service, followed by step-by-step instructions for creating the service.

System Requirements

The Create a Service wizard uses third-party tools to generate the web service code from a WSDL as follows:

  • For web services generated in Java, the wizard uses the Apache WSDL to Java (wsdl2java) tool. This tool is included with the Eggplant Performance Studio installation. You do not need to install it.

  • For web services generated in C#, the wizard uses the Microsoft Web Services Definition Language Tool (wsdl.exe).

    Important

    This tool is not included with the Eggplant Performance Studio. You must obtain it elsewhere. For example, it is included with Microsoft Visual Studio.

Creating Web Services with C#

If you want to generate your services and, later, scripts in C#, you must perform the following set-up tasks:

  1. Obtain and install the Microsoft WSDL tool.

  2. Provide the file path location of that tool in the wsdl.exe field in Eggplant Performance Studio General Preferences. For information about the Preferences, see Eggplant Performance Studio Preferences.

Step by Step: Using the Create a Service Wizard for SOAP Web Services

To create a web service in Eggplant Performance Studio follow these steps:

  1. Open the workspace in which you want to create the web service, or create a new workspace. You can find instructions in Creating a New Workspace.

    Workspace tree in Eggplant Performance Studio showing web services Workspace tree in Eggplant Performance Studio with Web Services highlighted

  2. In the Workspace tree under Applications Under Test, right-click Web Services, and select Create new SOAP web service from WSDL. The Create new SOAP web service from WSDL dialog box opens with Java selected in the Language field by default.

    Create web service dialog box in Eggplant Performance Studio is for creating a web service from a WSDL The Create new SOAP web service from WSDL dialog box in Eggplant Performance Studio is for creating a web service from a WSDL

  3. Provide the information in the Create new SOAP web service from WSDL dialog box field as follows:

    • Choose WSDL location: Specify the WSDL for the service you want to create. You can either enter a file location or URL of the WSDL you want in the field, or use the browse button on the right side of the field to navigate to a WSDL file and select it. The WSDL file extension can be .wsdl, .xml, or .xsd.
    • Service name: After you enter the WSDL, click any other field on the Create new SOAP web service from WSDL dialog box and the Service name and Package fields should populate automatically based on the information from the WSDL as shown below.
    warning

    If these fields do not populate automatically, the WSDL you specified might be invalid or the server hosting the WSDL could be down. Verify that your WSDL is valid, and that the server hosting it is running.

    Create web service dialog box populated with information from the WSDL and configured for Java The Create new SOAP web service from WSDL dialog box populated with information from the WSDL and configured to create a service in Java

    • Description: (Optional) Enter a description for the service.
    • Language: Select the programming language in which you want to create the service. You can accept the default, Java, or choose the other supported language, C#. When you select C#, the Create new SOAP web service from WSDL dialog box changes, replacing the Package field name with the Namespace and the namespace for the WSDL.

    Create Service dialog box configured to create the service in C# and populated with information from WSDL Create new SOAP web service from WSDL dialog box configured to create the service in C# and populated with information from WSDL

    • Advanced: Click this button to display an Advanced Options dialog box. These options let you specify additional options when you create your web service. See Using Advanced Options for Creating a Service below for information about these options.
  4. When you finish entering information on the Create new SOAP web service from WSDL dialog box, click OK. The Generating SOAP Service status dialog box opens, showing you the progress of the service creation.

  5. Click Close when generation is complete. The new web service opens in the Eggplant Performance Studio workspace Viewer pane, showing its name, WSDL, operations, and files. The service is also listed under Web Services folder under Applications Under Test in the Workspace tree.

New web service open in the Eggplant Performance Studio Workspace Viewer pane

Using Advanced Options for Creating a Web Service

When you create a web service, Eggplant Performance lets you specify additional options when you generate code from the WSDL. You can enter these options using the Advanced Options dialog boxes. You display the Advanced Options dialog boxes by clicking the Advanced button on the Create web service dialog box. The dialog box you see and the options available depend on the programming language you specified (Java or C#) in the Languages field on the Create Service dialog box.

Advanced Options for C# Web Services

When you choose to generate the code for your web service in the C# programming language, Eggplant Performance Studio uses the Microsoft Web Services Description Language Tool (wsdl.exe) to generate the code. In this case, when you click the Advanced button on the Create web service dialog box, the Wsdl.exe Advanced Options dialog box opens. This dialog box provides the Additional Command Line Parameters window in which you can enter additional command line options to pass to the Microsoft WSDL Tool. For information about the command line options available for this tool, you can use the link to the Microsoft MSDN documentation for it on the Wsdl.exe Advanced Options dialog box.

Advanced Options dialog box for creating a C# web service The Wsdl.exe Advanced Options dialog box for creating a C# web service

Advanced Options for Java Web Services

When you choose to generate the code for your web service in the Java programming language, Eggplant Performance Studio uses the Apache WSDL to Java (wsdl2java) tool. In this case, when you click Advanced button on the Create Service dialog box, the wsdl2java Advanced Options dialog box opens. It contains three windows, which you can use as follows:

  • Additional command line parameters: This window is for passing parameters to the wsdl2java tool, which you invoke with the wsdl2java.bat file.
  • Binding XML files: This window is for specifying XML binding files. You use the green plus or red x buttons to the right of the field to add or remove XML binding files.
  • Command line: This window is a read-only window that shows you the command that Eggplant Performance Studio uses to invoke the wsdl2java tool. The command you see reflects any additional parameters or binding XML files you specified in the two windows above. For information about the command line options available for the wsdl2java tool, or binding XML files you can use the link to the Apache CXF documentation for the tool on the Wsdl2java Advanced Options dialog box.

Advanced Options dialog box for creating a web service in Java The wsdl2java Advanced Options dialog box for creating a web service in Java

Enter any options you want in your Advanced Options dialog box and click OK to return to the Create a Service dialog box and finish creating the service.

Creating a Web Service (REST)

Eggplant Performance Studio provides the Create a Service wizard to make it easy for you to create a REST web service from a YAML/JSON file or URL. The following step-by-step instructions explain how to create the service.

note

There are no advanced options provided in the Create a Service wizard when creating REST web services.

Step by Step: Using the Create a Service Wizard for REST Web Services

To create a web service in Eggplant Performance Studio follow these steps:

  1. Open the workspace in which you want to create the web service, or create a new workspace. You can find instructions in Creating a New Workspace.

    Workspace tree in Eggplant Performance Studio showing web services Workspace tree in Eggplant Performance Studio with Web Services highlighted

  2. In the Workspace tree under Applications Under Test, right-click Web Services, and select Create new REST web service from OpenAPI specification. The Create web service dialog box opens with Java selected in the Language field by default.

    Create new REST web service from OpenAPI specification dialog box configured for Java Create new REST web service from OpenAPI specification dialog box in Eggplant Performance Studio is for creating a REST web service from an OpenAPI specification

  3. Provide the information in the Create new REST web service from OpenAPI specification dialog box field as follows:

    • Choose OpenAPI JSON or YAML location: Specify the location of the JSON or YAML file for the service you want to create. The location can point to a file on the computer (click the Browse button to navigate to the file), or it can be a URL.
    • Service name: After you enter the JSON or YAML file location, click any other field on the Create new REST web service from OpenAPI specification dialog box and the Service name and Package fields should populate automatically.
    • Description: (Optional) Enter a description for the service.
    • Language: Select the programming language in which you want to create the service. You can accept the default, Java, or choose the other supported language, C#. When you select C#, the Create new REST web service from OpenAPI specification the dialog box changes for your new selection.
  4. When you finish entering information on the Create new REST web service from OpenAPI specification dialog box, click OK. The Generating Web Service status dialog box opens, showing you the progress of the service creation.

  5. Click Close when generation is complete. The new web service opens in the Eggplant Performance Studio workspace Viewer pane. The service is also listed under Web Services folder under Applications Under Test in the Workspace tree.

    New web service open in the Eggplant Performance Studio Workspace Viewer pane

Regenerating a Web Service

You might need to regenerate your service from the WSDL or YAML/JSON file from time-to-time. The information shown below shows an example of regenerating a service from the WSDL. For example, if your WSDL changes and you need to test a new version, or you are testing a system that is still under development. You can regenerate your web service anytime by selecting it in the Eggplant Performance Workspace tree, right-clicking, and choosing Regenerate web service. The Regenerate web service dialog box opens.

The Regenerate web service dialog box for regenerating a service from a WSDL The Regenerate web service dialog box in Eggplant Performance Studio

Use the fields on this dialog box to regenerate your web service as follows:

  • Choose WSDL location: For a SOAP web service, this field contains either the WSDL used to create the service, or the WSDL specified the last time the service was regenerated. You can use the WSDL specified in the field again to regenerate the service, or specify a different one. For a REST web service, this field differs in that it asks you for a YAML/JSON file. See Creating a Web Service (SOAP) or Creating a Web Service (REST) above for information about this field.
  • Advanced (SOAP only): This button displays either the Wsdl.exe Advanced Options dialog box for C# web services or wsdl2java Advanced Options dialog box for Java web services. For more information about Advanced Options, see Using Advanced Options for Creating a Web Service above. The window or windows in the Advanced Options dialog box contain any options that were passed to the tool when the code was generated from the WSDL either when the service was created or last regenerated. You can change the options you specify and they will be used to regenerate the code, and then saved with the web service for future use.

When you are finished making any changes in the Regenerate web service dialog box, click OK to regenerate the service. The Generating SOAP service dialog box opens, showing you the status of the service regeneration. When the "Generation Complete!" message displays, click Close to dismiss the dialog box.

note

For regenerating REST web services, the regeneration process is similar, with dialog box names that relate to regenerating a REST web service.

Renaming a Web Service

You can rename your web service by selecting it in the Eggplant Performance Workspace tree, right-clicking, and choosing Rename web service. When the Rename web service dialog box opens, it provides a default name. You can use the default or specify a new name and optionally a description. Click OK to save the new name.

Rename web service dialog box in Eggplant Performance Studio Rename Service dialog box for web services in Eggplant Performance Studio

Deleting a Web Service

You can delete your web service by selecting it in the Eggplant Performance Studio Workspace tree, right-clicking, and choosing Delete web service. The Delete web service dialog box opens prompting you to confirm that you want to delete the web service. Choose Yes to delete the service or No to cancel the deletion.

Delete web service confirmation dialog box in Eggplant Performance Studio Delete web service confirmation dialog box in Eggplant Performance Studio