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:
- Plan Application Service.
- Create an Application Class which will provide the application logic.
- Create Application Service.
- Create or import a root resource.
- Add URI templates.
- Add base template parameters to URI Template.
- Add method to URI template.
- Add input and output parameters to method.
- Optionally assign headers for the method.
- 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:
- To access Application Services from the menu, select PeopleTools, Integration Broker, Application Services.
- Select Manage Application Services.
- Click Create Application Service.
- 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.
- Click Save.
- Click OK on message that the Application Service was created.
- 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 the illustration music_app_service.png
Creating Root Resource
To create a Root Resource:
- Select the Create Root Resource button.
- 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 the illustration create_root_resource_page.png - Click Done.
- Save the Application Service.
- Click OK on the message that the Application Service was saved.
Creating the URI Template
To create the URI Template:
- Click on the Root Resource band.
- Click Add URI Template.
- Select Add Base Template Parameter.
- 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 the illustration parameter_details.png - Click Done.
- Click Add To Workspace for instrument.
- Click Append to URI.
- Click Done.
- The URI Template is added to the Root Resource.
Description of the illustration root_resource_with_uri.png
![Add URI Template page Description](images/add_uri_template_page.png)
![Description of uri_template.png follows](images/uri_template.png)
Adding Method
To add a method:
- Click the Add Method button.
- 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 the illustration add_method_page.png - 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](images/GET_method.png)
To add parameters:
- Click the Parameters link.
- Click the Create Output Parameter button.
- Add a parameter for instrument.
Field Value Name instrument Parameter Data Type String Parameter Length 30 IB Required No Description instrument - Click Done.
- Click the Create Output Parameter button.
- Add a parameter for number of players.
Field Value Name numPlayers Parameter Data Type Number IB Required No Description number of players - Click Done.
- Click the Create Output Parameter button.
- Add a parameter for play date.
Field Value Name playdate Parameter Data Type Date IB Required No Description play date - Click Done.
- Click Done on the Parameters page.
- Click the Parameters link to display all parameters.
-
Description of the illustration output_parameters.png - Click the Copy icon for each parameter to add them to Base Parameters.
- Click Done.
Updating Result States
To update Result States:
- Click the Result States link.
- Change the Application States for Success to SUCCESS - PLAY
MUSIC.
Description of the illustration result_states.png - Click Done.
- Click Done on the Root Resource page.
- Click Save on the Application Service page.
- Click OK.
Adding POST Method
To add another REST method to the existing URI for the MUSIC Application Service:
- 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. - Expand URI Template 1.
- Click the Add Method button.
- 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 the illustration POST_method.png - Click Done.
- Click the Parameters link.
- Click Create Input Parameter.
- Add an input parameter for player.
Field Value Name player Data Type String Length 30 IB Required No Description player - Click Done.
- Click Create Input Parameter.
- Add an input parameter for musicCode.
Field Value Name musicCode Data Type Integer IB Required No Description music code - Click Done.
- Click Create Output Parameter.
- Add an output parameter for results.
Field Value Name results Data Type String Length 30 IB Required No Description results - Click Done.
- Click Done on the Parameters page.
- Click the Parameters link.
-
Description of the illustration POST_parameters.png - Click Done.
Adding Headers
To add headers:
- Click the Header link.
- Enter the following for Request header:
Field Value Header Type Request Property Name Accept-Language Value ENG Description Language - Click the Add Row icon (+).
- Enter the following:
Field Value Header Type Response Property Name Type Description Instrument type - Click Done.
- Click Done on the HTTP Headers page.
- Click Done on the Root Resource page.
- Save the Application Service.
- Click OK on the message that the Application Service was saved.
![Desrciption of http_headers.png](images/http_headers.png)
Next Steps
Test Application Service
Create Application Service
F54568-01
March 2022
Copyright © 2021, Oracle and/or its affiliates.
Learn how to create an Application Service.
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software" or "commercial computer software documentation" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract. The terms governing the U.S. Government's use of Oracle cloud services are defined by the applicable contract for such services. No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.