The following steps show you how to use the sample web
services code. Rational® Software
Architect can be used to develop and test the web services.
Before you begin
- Make sure that you are using Java™ 1.6. Rational Software Architect
must be set up with a WebSphere® Application
Server profile using the required class path and environment variables.
- Copy the entire installation directory to your development box.
Procedure
- Import web services project into Rational
Software Architect.
- Extract the web services samples project.
- In Rational Software Architect, enable and
open Java Platform, Enterprise Edition perspective to be able to see the
Servers window.
- Right click the navigation Enterprise Explorer. Click
Import > General > Import Existing Projects into Workspace. Click
Next.
- Choose Select root directory. Browse to the
webservices/samples folder and click OK.
- Click Finish.
- Build the project.
- Expand the WebServiceSamples project and locate the
build.xml file.
- Right click build.xml and select Run As > Ant
Build. The build fails.
- Right click build.xml and select Run As > External
Tools Configuration.
- In External tools Configuration, Main tab, enter for
Arguments the following entry:
-Dmdmpim.home=<MDMPIM install
directory>
- Click OK.
The successful build creates a
webservices.samples.war file in the folder
webservices/samples/build.
- Import WAR file.
- Right click the blank space of Enterprise Explorer. Click Import > WAR
file.
- Click Browse to browse the WAR file
webservices/samples/build/webservices.samples.war.
- Click Finish.
Two projects
webservices.samples and webservices.samplesEAR are
imported to the workspace.
- Deploy the web services using Rational
Software Architect.
- Go to the Servers tab.
- Right click the server you want to deploy the web services in and click Add
and Remove Projects.
- Add the project
webservices.samplesEAR
.
- Click Finish.
- Start the server. Make sure that the server and application are both
synchronized.
- Test the web services.
- In the project
webservices.samples
, locate
WebContent/WEB-INF/wsdl/SchedulerService.wsdl
- Right click SchedulerService.wsdl and select Web
Service > Test with Web Services Explorer.
- In web Services Explorer, add the endpoint by clicking the Add
link next to the Endpoints table. Enter the following by replacing port 9083 with your HTTP port.
Make sure that your endpoint is pointing to the correct port as selected in your server profile.
http://localhost:9083/webservices.samples/SchedulerService
- Select the new endpoint created and click Go.
- You can now test the operations that are listed. For all of the operations,
Context
is a required input. Enter a valid company, password, and user name as
arguments for the Context object. Depending on the operation, you are testing, you might need to
enter the arguments for Job object and Schedule object. You get an input validation error whether
the arguments are missing.
- After all of the arguments are entered, click Go to start the
web service.
Results
Return values are obtained from web services calls.
What to do next
Use this sample as an example to create your own web services using
the Java APIs.