Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space FUNCTDEV and version SOAVIRT_9.10.4_CTP_3.1.1

This topic explains how to extend 

...

extend the SOAtest and Virtualize

...

 and interfaces and operations to cover message formats not supported by default.

...

Once a custom message format has been added,

...

SOAtest and Virtualize

 will automatically make a new

...

client or responder

 available SOAtest and Virtualize will automatically make a newclient or responder available for for configuring and sending request or response messages using that format. You can add instances of the new client/responder to your test scenarios or responder suites.

...

See

...

Custom Client and Custom Message Responder

...

 for details about how to use them. The new message format will also appear in the XML Converter tool, which is described in XML Converter.

...

After setting up your environment (

...

see General Procedure of Adding an Extension for instructions in Virtualize or General Procedure of Adding an Extension for SOAtest

...

), implement the following interfaces (described in the Extensibility API documentation):

...

After you have implemented the necessary classes, define parasoft-extension.xml (introduced in

...

General Procedure of Adding an Extension in SOAtest and General Procedure of Adding an Extension in Virtualize

...

) using the following schema:

...

  • <defaultMimeType>: Specifies the default MIME type for your message format. The MIME type is used to identify the type of information that your message contains. The default MIME type is used as the Content Type in message headers when sending messages.
  • <messageTypes>: This is an optional element that defines a set of specific message types. If no messageTypes element is provided, you are defining a general conversion between a native format and XML that has no specific message types defined. An example of such a format is CSV.
    • generatorClass - An optional attribute that holds the fully-qualified name of a class which implements ISchemaGenerator.
  • <messageType>: Defines a message type for your custom message format.
    • id - A string identifier for your message type. Must be unique within a given message format. Also is used when saving clients/responders, so changing it will result in saved clients or responders not being able to resolve the message type that they are using.

    • name - Used to display the name of your message type in the GUI.
    • xsd - A URL path to your xsd. This attribute is required if you did not provide a generator class. Otherwise, it is ignored.

...

  • <client>: Optional element that holds some basic information for the custom SOAtest client generated for your custom message format.
    • icon - An optional attribute that specifies an icon to display in the GUI for the custom SOAtest client. This is a relative path to an icon that is contained within a jar file or Java project on the SOAtest classpath. If not provided, SOAtest will use its default tool icon for the custom SOAtest client.
    • defaultTransport - An optional attribute; the default SOAtest transport to be used in the client. Possible values are:
      • HTTP 1.0 (default)
      • HTTP 1.1
      • JMS
      • SonicMQ
      • WebSphere MQ
      • RMI
      • SMTP
      • TIBCO
      • .NET WCF HTTP
      • .NET WCF TCP

...

...

  • <responder>: Optional element that holds basic information for the custom Virtualize responder generated for your custom message format.
    • icon - An optional attribute that specifies an icon to display in the GUI for the custom Virtualize responder. This is a relative path to an icon that is contained within a jar file or Java project on the Virtualize classpath. If not provided, Virtualize will use its default tool icon for the custom Virtualize responder.

Verifying the New Message Format

  1. Build the project (see

    Conditional ContentProduct: (SOAVirt)Product: (SOAVirt)sv-attr:0A010204015A9054C88481D043445E2F0A010204015CF6008A11EEF43AC91334see 

    seesee General Procedure of Adding an Extension in Virtualize or General Procedure of Adding an Extension in

    SOAtest

    ) and restart

    Conditional ContentProduct: (SOAVirt)Product: (SOAVirt)sv-attr:0A010204015A9054C88481D043445E2F0A010204015CF6008A11EEF43AC91334SOAtest

    SOAtest) and restartSOAtest or Virtualize.

    Conditional Content

    Virtualize.

  2. Verify that a new client/responder that contains the name of your message format is available to add to a .tst or .pva file by choosing Add New> Test or Responder.

...

  • GUI fields that are defined in the parasoft-extension.xml file appear in the Conversion Options tab of the custom message format client/responder.

  • The values provided to the extension GUI are saved as a name-value String map. As a result, rearranging the fields in the form element in parasoft-extension.xml will not affect how the user values are saved; however, changing the ids will affect this. The ids are used to save/load the values so they need to be unique. If you change them, then previously-saved configurations will not load the previous values and will become empty. However, you can use a version updater to migrate old settings saved with old ids to a new set of ids.
  • Only GUI fields with string values are supported in the custom form GUI. If your extension requires integers or other types, then you may convert the string content to the desired type in the extension implementation.

...

  • If you want a GUI field to serve as a password field  (with inputs masked and the specified password saved securely), give that field element a type attribute that is set to password. For example, the following sets the pwd field to password mode:

    Code Block
    <form xmlns="urn:com/parasoft/extensibility-framework/gui">
    	<section label="Main Settings">
      		<field id="usr" label="Username"/>
      		<field id="pwd" label="Password" type="password"/>
    	</section> 
    </form>

  • Tables or lists can be implemented as comma-separated values in the string fields.

...

Example

Assume that you have the custom message format SimpleMessage, which consists of key and values pairs with a space delimiter (for example: key1=value1 key2=value2 key3=value3 key4=value4).

Once this custom format is added to SOAtest, SOAtest will be able to convert between SimpleMessage and XML. For example, it can convert 

Code Block
key1=value1 key2=value2 key3=value3 key4=value4

to/from

Code Block
<?xml version="1.0" encoding="UTF-8"?> 
<message xmlns="">
    <body>
		<key1>value1</key1>
		<key2>value2</key2> 
		<key3>value3</key3> 
		<key4>value4</key4>
    </body> 
</message>

There are two messages types defined for this project. 

  • NameSchema: Contains two key values pairs where the keys are FirstName and LastName.
  • SimpleSchema: Contains the four key value pairs referenced above.

There are two ways to add this sample custom format to SOAtest: from the Java source project you can download from Parasoft’s Marketplace, or from a jar file that you can create from this project.

Adding the Format from the Java Source Project

To add the sample format from a Java source project:

  1. Download the SimpleMessage.zip file from http://marketplace.parasoft.com and extract it.
  2. Import the extracted files into your workspace as a Java project.

    Image Modified
  3. In the SOAtest perspective, choose Parasoft> Preference, select System Properties, click Add Java Project, indicate the location of the sample Java project, then click Apply.

    Image Modified 
     
  4. Restart SOAtest

Creating a Jar File

The Java source project is provided so you can review the sample source code. Jar files are typically easier ways to share custom formats across a team. 

To convert this sample Java project to a jar file:

  1. In the Java perspective, right click the Java project, then choose Export.
  2. Choose Java> JAR file, then click Next.

    Image Modified

  3. Indicate where you want the jar file created, then click Finish.

    Image Modified 

Adding the Format from the Jar File

Other team members can now add the custom format from a jar file (rather than from the Java project—you do not need to complete these steps if you have already added the format from the Java project as described above):

  1. In the SOAtest perspective, choose Parasoft> Preference, select System Properties, click Add JARs, indicate the location of the sample jar file, then click Apply.

    Image Modified 
     
  2. Restart SOAtest

Using the Custom Format in SOAtest Tools

Once the example is added to SOAtest, you can create SimpleMessage Client tools as well as use the format in the XML Convertor tool. 


Image Modified

Image Modified

For SimpleMessage clients, you can use one of the message types or enter your own key value pairs in literal mode. 


Image Modified