In this lesson, you will learn how to create a service
stub from a Web Service Description Language (WSDL) specification.
Service stubs are simulations of an actual service, which
can be used to functionally replace the service in a test environment.
A stub server replaces the actual application server in cases where
it is not practical to use it. For example:
If you are testing a local service that uses data from another
remote service, you might need to inject specific content to the service
under test from the remote service. You can simulate the remote service
with a service stub to ensure that the local service responds properly
to some specific input.
Some commercial service providers charge users for each request.
If you are testing such a service, you can develop and debug your
test against a stub service, which is based on the WSDL of the actual
service, without being charged by the service provider.
During integration of a large application involving multiple clients
and services, some services might not yet be operational, although
their WSDL specifications are available. You can simulate the missing
services with service stubs, which will allow you to proceed with
the integration work.
From the point of view of the client application, the
service stub looks identical to the actual service that it simulates.
To use a service stub in replacement of the actual service, you must
be able to replace the URL of the original service in the client application
with the URL of the stub server.
You create a service
stub by providing an existing Web Service Description Language (WSDL)
specification. The service stub is generated with the exact same ports
and bindings as the original service so that it can be addressed with
exactly the same interface. Each operation in the service returns
a default response of the type defined by the WSDL.