A Web service stub provides replacement implementations for another
Web service that the Web service under test interacts with. By creating a
Web service stub, you can better isolate the testing of the Web service under
test. You can create stubs for Web service components by clicking File
> New or you can create stubs for a particular test suite from
the Test Suite editor.
To create a stub for a Web service:
- Click and
click Next.
- Select the test project that will contain the stub and click Next or
click New to create a new project and click Next.
- Locate the WSDL definition file for the Web service that you want
to stub. You can use Browse to use a WSDL
from your workspace, or use Import to import the file
from the filesystem.
- Select one or several bindings that you want to stub. For
information about bindings, see the Web Services Description Language (WSDL)
reference.
- In the Web service runtime Java proxy generation list,
select the runtime (IBM® WebSphere® or Apache Axis) that you want to
use to generate the Java™ proxy for the stub.
Note: You
cannot use multiple runtimes within a single project. If a Web service component
test or stub already exists in the current test project, then you can only
use the runtime that was previously used in the project. To create a stub
using a different runtime, you must create a new test project.
- Click Finish. If the stub component
already exists, the wizard prompts you to replace the existing stub. If you
select Yes or Yes to All, then
any changes you have made to the existing stub will be overwritten. If you
select No or No to All, then
the existing files remain unchanged and a new stub is not generated.
- In the Test Navigator view, double-click the test suite to which
you want to add the stub. This opens the Test Suite editor.
- In the Test Suite editor, click the Stubs tab,
click Add, select the stub you want to add to the test
suite, and click Finish.
Note: To create a new stub and
add it automatically to the test suite, click New and
proceed with Step 3.
To replace the stub with the real class at any time, simply remove
the stub from the test suite.