Asynchronous service testing overview

Asynchronous services use a callback interaction pattern for inter-object communications. Asynchronous services can be used, for example, in publish-subscribe systems that are provided by message-oriented middleware vendors or in system and device management domains.

WS-Notification services

Asynchronous services are standardized in the WS-Notification specifications:

  • WS-BaseNotification defines the web services interfaces for NotificationProducers and NotificationConsumers. This specification includes standard message exchanges that are implemented by service providers that want to act in these roles, along with the associated operational requirements.
  • WS-BrokeredNotification defines the web services interface for a NotificationBroker. A NotificationBroker is an intermediary which, among other things, enables entities that are not service providers themselves to publish messages. It includes standard message exchanges that are implemented by NotificationBroker service providers, along with the associated operational requirements of service providers and requestors that participate in brokered notifications.
  • WS-Topics defines a mechanism to organize and categorize items of interest for subscription known as topics. These are used in conjunction with the notification mechanisms defined in WS-BaseNotification and WS-BrokeredNotification.

You can test web services and XML services that implement the WS-Notification specification by creating an asynchronous request inside a test. The asynchronous request contains the interfaces for the corresponding WS-Notification specification, along with a callback structure.

Proprietary asynchronous services

You can test proprietary asynchronous services that do not implement WS-Notification specifications. To test these services, you manually create a service request that contains the interfaces for the service, and then, you can add the asynchronous callback structure to the request.

The XML data of the asynchronous request must contain an endpoint that specifies the URL of the callback receiver. During the test, this endpoint is used to redirect the callback to the tester instead of the real receiver.

Callback structure

To test asynchronous services, you must create an asynchronous request structure in your test as shown in the following diagram:

Example of asynchronous request structure
A web service request or a plain XML request provides the subscription action and contains a callback element, which describes the behavior of the test in three states:
  • Parallel contains test elements that are run after the subscription request and while waiting for the notification response.
  • Receive contains test elements that are run when the notification response has been received from the service.
  • Timeout contains test elements that are run if the notification response is not received after a delay that is specified in the callback element.

When everything contained in the parallel, receive, and timeout elements have finished running, the run continues with the next element in the test after the asynchronous request.

The method for generating the asynchronous callback structure in the test depends on whether the asynchronous service uses the WS-Notification specification:
  • WS-Notification services: Create the asynchronous request in the test.
  • Proprietary services: Manually create a web service request or XML request in the test, and then add the asynchronous callback structure to the request.