+

Search Tips   |   Advanced Search


Stub case details

Stub case elements enable you to specify the response of a service stub according to the content of an incoming call. You can perform checks on the contents of the XML document of the message return, the number of nodes returned by an XPath query, or the existence of a specific attachment. Each case element has an associated response element. There can be multiple case elements in a stub operation, but the Case : Default element is mandatory.


Default case

The default case contains the default response when no other criteria has been met. When multiple cases are defined, the default case is always the last one to be evaluated.


Contain and equal cases

Contain cases send their response when the incoming call contains the specified XML message. Equal cases send their response when the incoming call matched the specified XML message.

The verification occurs if the message return object is a valid XML message. The verification is performed on both the name of the XML element and final return value of the element. Attributes are not checked.

Use the Form, Tree and Source views to edit the message content.

Test using XML namespace

Perform the verification on a qualified structure, including the XML namespace, instead of the simple name.

For example, if the expected XML data is:

<ns1:responseElement xmlns:ns1="http://www.ibm.com/wbse"></ns1:responseElement>
When Namespace aware is enabled, the verification is made on the full name of the return value:

<ns1:responseElement xmlns:ns1="http://www.ibm.com/wbse"></ns1:responseElement>
When Namespace aware is disabled, the verification ignores the namespace tagging and checks only the simple name of the element and the final return value:

<ns1:responseElement xmlns:ns1="http://www.ibm.com/wbse"></ns1:responseElement>
In this case, you can simplify the value of the expected XML data to:

<responseElement><responseElement>

Test XML text nodes

Include XML text values in the verification.

Test XML attributes

Include XML attributes in the verification.

Form

This view provides an simple view of the elements of the call with their values. Use this view to quickly edit values in the form.

Tree

This view provides a hierarchical view of the elements of the call with their values, attributes, and the associated namespaces. You can use Add, Insert, Remove, Up, and Down to edit this list.

Click the namespace, attribute, or text filter buttons, depending on requirements.

Click Allow only valid modifications to enable smart editing, based on a specified XML schema document (XSD).

To specify a set of XSD documents for the workbench, in the test navigator, right-click the project and select Properties and Schema Catalog. Disable smart editing if you do not have an XSD or if to bypass the schema.

You can specify standard Java™ regular expressions. In the Regexp column, select the line of an attribute or text value and type the regular expression in the Value column. For example, the following regular expression checks for a correctly formatted email address: /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/

Source

This view displays the source XML document of the call.

The ID tags that are shown in the Source page refer to an internal representation for the test. If you remove these tags, you will remove any existing references and substitutions. You cannot re-create these tags after you delete them.


Query case

Query cases send their response when the number of nodes returned by an XML Path language query matches the expected number of nodes specified in the case element.

The verification occurs if the message return object is a valid XML document.

XPath expression

Specify a query using the XML path language. Refer to the XPath specification for details on expressing an XPath query: http://www.w3.org/TR/xpath. Click Build Expression to open the XPath Expression Builder window.

Because XPath expressions require that the qualified name has a prefix, XPath expressions will return null for the default namespace declared with xmlns.

Operator and Expected Count

These specify the expected number of nodes returned by the query.

Evaluate

Click this button to calculate the number of nodes based on the current input. This value automatically replaces the current Expected count.


Default case

Attachment verification points return a Pass status when the message return attachment matches all of the criteria specified in the verification point.

The verification occurs only if the message return object is a valid XML document.

Enable verification point

When selected, the test verifies whether the Web service message return objects match the expected criteria of the verification point. An error is reported in the test log if the message return does not match the expected criteria.

Index of the attachment to be verified

In the case of multiple attachments, this number specifies which attachment to check.

Attachment size

This specifies the expected size of the attachment.

MIME type

This specifies the expected MIME type of the attachment.

Encoding

This specifies the expected encoding of the attachment.


Related reference

  • Stub operation details
  • Stub response details