Custom Factories

Overview

soapUI 4.0 introduces an extensive factory-based extension mechanism allowing you to add a large number of custom objects to soapUI, including TestSteps, Assertions, Editor Views, etc.To add a custom factory to soapUI you need to:

  1. Implement the desired factory interface and related classes
  2. Package the implementation in a jar file that you put in the soapUI\bin\ext folder
  3. Create an xml configuration file named XXX-factories.xml that registers the factory with soapUI
  4. Save the configuration file in a folder named "factories" in the soapUI\bin folder
  5. (Re)start soapUI

Here comes a list of all available factory extension points together with links to the corresponding javadoc

  • Editor Views - allows you to create custom editor views displayed with vertical tabs in the request/response message editors. For example you might want to create a specific input editor or message visualizer for specific types of messages. See EditorViewFactory - implement the corresponding sub interfaces for request and response editors are desired.
  • Inspectors - allows you to create custom message inspectors displayed with horizontal tabs at the bottom of corresponding request/response message editors. See InspectorFactory - implement the corresponding subinterfaces for request and response editors are desired.
  • Preferences - Allows you to add custom pages to the global preferences dialog - see PrefsFactory
  • RequestFilters - Allows you to add custom RequestFilters for modifying outgoing or incoming requests - see RequestFilterFactory
  • RequestTransport - Allows you to add custom request protocols - see RequestTransportFactory and example below
  • Assertions - Allows you to create custom assertions - see TestAssertionFactory
  • TestSteps - Allows you to create custom TestSteps - see WsdlTestStepFactory - make sure you create a corresponding PanelBuilder (see below)
  • PropertyExpanders - Allows you to add custom property resolvers used by the PropertyExpansion engine - PropertyResolverFactory
  • PropertyResolvers - Allows you to add custom global properties available for property expansion - see ValueProviderFactory
  • PanelBuilders - Allows you to create custom desktop panels for inherent soapUI objects and custom TestSteps as registered with the WsdlTestStepFactory mentioned above - see PanelBuilderFactory
  • SecurityScans - Allows you to add custom Security Scans - see SecurityScanFactory
  • SubReports - Allows you to create custom sub reports for the JasperReports based reporting - see SubReportFactory

Configuration

As mentioned above you will need to create an xml configuration file for registering your custom factories. A sample file is as follows:

<soapui-factories>
   <factory id="..." factoryType="..." factoryClass="..."/>
   <factory id="..." factoryType="..." factoryClass="..."/>
</soapui-factories>

The following attributes are required for each factory element:

  • id - a unique identifier for each factory in the file
  • factoryType - the factory interface implemented by the factory (one of the above)
  • factoryClass - the actual class implementing the interface

For example

<soapui-factories>

   <factory id="FileTransport" factoryType="com.eviware.soapui.impl.wsdl.submit.RequestTransportFactory" 
   factoryClass="com.mycorp.soapui.factories.FileTransportFactory"/>

   <factory id="MyEditor" factoryType="com.eviware.soapui.support.editor.registry.EditorViewFactory" 
   factoryClass="com.mycorp.soapui.factories.CustomRequestEditor"/>

</soapui-factories>

would register a custom RequestTransport and a custom Request Editor.

Be sure to save the file in the soapUI\bin\factories folder (create it if missing) and restart soapUI to active your custom factories.