Before you Begin

In this 30 minute tutorial, you will create a sample Application Service for Music. This Application Service will use the Application Class created in the Plan and Create Application Class tutorial.

Background

Use the Application Service Framework to create and test Oracle Standard REST Provider Services.

The tutorials in this series describe processes used create the Application Class for the Application Service, create the Application Service and test the Application Service. In this series, you will create a sample Application Service.

Creating a Provider Application Service involves the following steps:

  1. Plan Application Service.
  2. Create an Application Class which will provide the application logic.
  3. Create Application Service.
  4. Create or import a root resource.
  5. Add URI templates.
  6. Add base template parameters to URI Template.
  7. Add method to URI template.
  8. Add input and output parameters to method.
  9. Optionally assign headers for the method.
  10. Define result states for the method.

This is the second tutorial in the Create Application Service series. Read the tutorials in the order listed.


Creating Application Service

To create a provider Application Service:

  1. To access Application Services from the menu, select PeopleTools, Integration Broker, Application Services.
  2. Select Manage Application Services.
  3. Click Create Application Service.
  4. Enter the following:
    Field Value Notes
    App Service ID music
    Service URLID music The service URLID must be lowercase.
    SSL No
    Service group example Optional
    Description This service will get and update music information.

  5. Click Save.
  6. Click OK on message that the Application Service was created.
  7. When the application service is saved, the system will verify that the service ID meets the Oracle standards and that it is unique. The Application Service is created and the Create Root Resource and Import Root Resource buttons are available.
    Description of music_app_service.png follows
    Description of the illustration music_app_service.png

Creating Root Resource

To create a Root Resource:

  1. Select the Create Root Resource button.
  2. Enter the following:
    Field Value Notes
    Root Resource band
    Description Band Information
    Root Package ID APPSRVEXAMPLE The drop down list will only show Application Packages that import PTCBAPPLSVCDEFN:ApplicationServiceBase
    App Package Path :
    Application Class ID band
    Status Active By default the status is active.

    Description of create_root_resource_page.png follows
    Description of the illustration create_root_resource_page.png
  3. Click Done.
  4. Save the Application Service.
  5. Click OK on the message that the Application Service was saved.

Creating the URI Template

To create the URI Template:

  1. Click on the Root Resource band.
  2. Click Add URI Template.
  3. Description
    Description of Add URI Template page
  4. Select Add Base Template Parameter.
  5. Enter parameter details for instrument.
    Field Value Notes
    Name instrument Name must start with a lower case letter.
    Parameter Data Type String Available data types include:Boolean, Date, Decimal, Integer,
    String, or Time.
    Parameter Length 30 For a String enter the length
    Collection
    Indicates the value will be part of a collection of values.
    Description instrument

    Description of parameter_details.png follows
    Description of the illustration parameter_details.png
  6. Click Done.
  7. Click Add To Workspace for instrument.
  8. Click Append to URI.
  9. Description of uri_template.png follows
    Description of the illustration uri_template.png
  10. Click Done.
  11. The URI Template is added to the Root Resource.
    Description of uri_template1.png follows
    Description of the illustration root_resource_with_uri.png

Adding Method

To add a method:

  1. Click the Add Method button.
  2. Select the GET method.
    Field Value
    REST Method GET
    Multi Row Input No
    Multi Row Output Yes
    Token Required
    No
    Description Get number of players for a playdate

    Description of add_method_page.png follows
    Description of the illustration add_method_page.png
  3. Click Done.

Adding Parameters

For the GET method, you will add output parameters for instrument, number of players and play date.

Description of GET_method.png follows
Description of the illustration GET_method.png

To add parameters:

  1. Click the Parameters link.
  2. Click the Create Output Parameter button.
  3. Add a parameter for instrument.
    Field Value
    Name instrument
    Parameter Data Type String
    Parameter Length 30
    IB Required No
    Description instrument
  4. Click Done.
  5. Click the Create Output Parameter button.
  6. Add a parameter for number of players.
    Field Value
    Name numPlayers
    Parameter Data Type Number
    IB Required No
    Description number of players
  7. Click Done.
  8. Click the Create Output Parameter button.
  9. Add a parameter for play date.
    Field Value
    Name playdate
    Parameter Data Type Date
    IB Required No
    Description play date
  10. Click Done.
  11. Click Done on the Parameters page.
  12. Click the Parameters link to display all parameters.
  13. Description of output_parameters.png follows
    Description of the illustration output_parameters.png
  14. Click the Copy icon for each parameter to add them to Base Parameters.
  15. Click Done.

Updating Result States

To update Result States:

  1. Click the Result States link.
  2. Change the Application States for Success to SUCCESS - PLAY MUSIC.
    Description of result_states.png follows
    Description of the illustration result_states.png
  3. Click Done.
  4. Click Done on the Root Resource page.
  5. Click Save on the Application Service page.
  6. Click OK.

Adding POST Method

To add another REST method to the existing URI for the MUSIC Application Service:

  1. From the Application Service page, click the Root Resource band.

    Note:

    If the MUSIC Application Service is not open, then select the Recently visited icon and select Manage Application Services. Expand the Search section and search for music. Open the MUSIC Application Service and click the Root Resource band.
  2. Expand URI Template 1.
  3. Click the Add Method button.
  4. Enter the following values:
    Field Value
    REST Method POST
    Multi Row Input Yes
    Multi Row Output No
    Token Required No
    Description Add player and music code

    Description of POST_method.png fllows
    Description of the illustration POST_method.png
  5. Click Done.
  6. Click the Parameters link.
  7. Click Create Input Parameter.
  8. Add an input parameter for player.
    Field Value
    Name player
    Data Type String
    Length 30
    IB Required No
    Description player

  9.  Click Done.
  10. Click Create Input Parameter.
  11. Add an input parameter for musicCode.
    Field Value
    Name musicCode
    Data Type Integer
    IB Required No
    Description music code

  12. Click Done.
  13. Click Create Output Parameter.
  14. Add an output parameter for results.
    Field Value
    Name results
    Data Type String
    Length 30
    IB Required No
    Description results

  15. Click Done.
  16. Click Done on the Parameters page.
  17. Click the Parameters link.
  18. Description of illustration POST_parameter.png follows
    Description of the illustration POST_parameters.png
  19. Click Done.

Adding Headers

To add headers:

  1. Click the Header link.
  2. Enter the following for Request header:
    Field Value
    Header Type Request
    Property Name Accept-Language
    Value ENG
    Description Language
  3. Click the Add Row icon (+).
  4. Enter the following:
    Field Value
    Header Type Response
    Property Name Type
    Description Instrument type
  5. Click Done.
  6. Desrciption of http_headers.png
    Description of the illustration http_headers.png
  7. Click Done on the HTTP Headers page.
  8. Click Done on the Root Resource page.
  9. Save the Application Service.
  10. Click OK on the message that the Application Service was saved.

Next Steps

Test Application Service