06 August 2007 - 1.7.5 | home user-guide eclipse jbossws intellij netbeans maven 1.X/2.X PDF files forums bugs sourceforge

Home
Getting Started
User Guide

- Overview
  - Tabbed Desktop
  - License Management
  - Preferences
  - XPath Selection
  - Script Library
- Workspaces
- Projects
- Interfaces
  - Interface Viewer
- Operations
- Working with Requests
  - Form Editor
  - Outline Editor
  - Message Inspectors
  - Attachments/Inline Files
- Functional Testing
  - Getting Started
  - TestSuites
  - TestCases
    - Test Requests
      - Assertions
      - Editor Wizards
    - Property Transfers
    - Conditional Gotos
    - Groovy Scripts
      - Examples
      - GroovyUtils
    - Properties Step
    - Delay Step
    - Mock Response
    - DataSource
    - DataSource Loop
  - Property Expansion
- Load Testing
  - Getting Started
  - Limit & Strategies
  - Execution
  - Assertions
  - Diagrams
  - JMeter comparison
- Mocking
  - Getting Started
  - Mock Services
  - Mock Operations
  - Mock Responses
- Usage Scenarios
  - Data-Driven Testing
  - Template-Driven Testing
  - Interactive Testing
  - Surveillance Testing
- Tool Integrations
  - Code Generation
  - WSDL Generation
  - WS-I Tools
  - Apache Tcp-Mon
- CommandLine Tools
  - TestCaseRunner
  - LoadTestRunner
  - MockServiceRunner
  - ToolRunner
- Keyboard shortcuts

IDE/Tool Plugins
Search soapUI site
Project Documentation

- About soapUI
- Project Info
- Project Reports

## Mock Services

MockServices are displayed in the navigator under their containing project node. They can be created in a number of ways;

1. From the Project popup menu with the "New MockService" action. Creates an empty MockService with no operations.
2. From an existing request by selecting the "Create MockResponse" toolbar button which will prompt for which MockService to add the selected requests operation and current response as a MockResponse.
3. From the Interface popup menu with the "Generate MockService" action. This will prompt as follows:

   After specifying a path and port to listen on, soapUI will create a MockService with a MockOperation corresponding to each of the specified interfaces operation. Each MockOperation will further be configured with a default MockResponse which will be created from the associated WSDL/Schema definition in the same manor as when importing interfaces and creating requests.

Once created, an arbitrary number of MockOperations can be added to a MockService, there is no requirement that all operations come from the same interface or that all operations from an interface be mocked. Just mock those operations that are required.

### MockService Actions

Right-clicking a MockService node in the navigator shows a popup menu with the following actions: Open MockService Editor - opens the MockService Editor, see below New MockOperation - prompts to create a new MockOperation in the MockService Clone MockService - clones the entire MockService Add Endpoint to Interface - prompts to add this MockServices local endpoint to an Interface in the same project. The endpoint will be automatically updated if it changed in the MockService Editor. Rename - prompts to rename the MockService Remove - prompts to remove the MockService Online Help - displays this page in an external browser |

### MockService Details Tab

The bottom left details tab for a MockService displays the following properties: Name : the name of the MockService Description : an arbitrary description of the MockService, displayed as a tooltip over the MockServices' node in the Navigator. Path - the path this MockService listens on (read only) Port - the port this MockService listens on (read only) Require SOAP Version - controls if incoming requests must match the SOAP Version of a corresponding MockOperation in a MockService. |

### The MockService Editor

Double-clicking a MockService in the navigator opens the MockService editor as seen to the right. From the top down the editor has the following parts: A Toolbar with the following options: Run - Starts the MockService on the configured path/port and waits for requests (see below) Stop - Stops a running MockService Path - The path to listen on, disabled when running Port - The port to listen on, disabled when running Help - Opens this page in a browser The list of MockOperations currently configured for this MockService. Right-clicking show the MockOperations available actions, double-clicking opens the MockOperation editor A rolling log of handled requests with a toolbar with the following options: Enable - Enables the MockService log Clear - Clears all entries from the log Options - Prompts for the maximum number of entries to hold in the log. Keep this low as an entry can take up a fair amount of memory (depending on message size, attachments, etc..) Double-clicking on an entry in the log displays the entire message exhange for that request as shown below: |

### MockService execution

When starting the MockService using the Run toolbar button, soapUI starts a local http server (if not already running for another MockService) and makes the MockService available on the configured port and path. This can be seen in the soapUI-log as follows:

SOAP Requests can now be issued to the server from any client as if it were a "real" Web Service, the incoming requests will be dispatched to the matching MockService / MockOperation which will further dispatch as configured in Request Dispatching. While the MockService is running, it is still possible to add/remove MockOperations, MockResponses, etc.. The only values that can not be changed are the path and port of the MockService, for this it is required to first stop the MockService and then start it again after changing as desired.

If an error occurs during request processing a SOAP Fault will be returned, for example in the following situation a request was issued from within soapUI that could not be matched to any available MockServices MockOperation:

Next: Mock Operations