Using web services samples

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

  1. Import web services project into Rational Software Architect.
    1. Extract the web services samples project.
    2. In Rational Software Architect, enable and open Java Platform, Enterprise Edition perspective to be able to see the Servers window.
    3. Right click the navigation Enterprise Explorer. Click Import > General > Import Existing Projects into Workspace. Click Next.
    4. Choose Select root directory. Browse to the webservices/samples folder and click OK.
    5. Click Finish.
  2. Build the project.
    1. Expand the WebServiceSamples project and locate the build.xml file.
    2. Right click build.xml and select Run As > Ant Build. The build fails.
    3. Right click build.xml and select Run As > External Tools Configuration.
    4. In External tools Configuration, Main tab, enter for Arguments the following entry: -Dmdmpim.home=<MDMPIM install directory>
    5. Click OK.
      The successful build creates a webservices.samples.war file in the folder webservices/samples/build.
  3. Import WAR file.
    1. Right click the blank space of Enterprise Explorer. Click Import > WAR file.
    2. Click Browse to browse the WAR file webservices/samples/build/webservices.samples.war.
    3. Click Finish.
      Two projects webservices.samples and webservices.samplesEAR are imported to the workspace.
  4. Deploy the web services using Rational Software Architect.
    1. Go to the Servers tab.
    2. Right click the server you want to deploy the web services in and click Add and Remove Projects.
    3. Add the project webservices.samplesEAR.
    4. Click Finish.
    5. Start the server. Make sure that the server and application are both synchronized.
  5. Test the web services.
    1. In the project webservices.samples, locate WebContent/WEB-INF/wsdl/SchedulerService.wsdl
    2. Right click SchedulerService.wsdl and select Web Service > Test with Web Services Explorer.
    3. 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
    4. Select the new endpoint created and click Go.
    5. 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.
    6. 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.