Adding a REST Binding

Procedure

  1. Add the details of the REST binding to the rest_binding_data.xml file.

    Sample data for the application available in TIBCO_HOME\amx\<version>\samples\rest\samples\bookstore\com.tibco.restbt.sample.bookstore\Deployment Artifacts\com.tibco.restbt.sample.bookstore.daa is shown below:

    <Environment xsi:type="amxdata:Environment" name="DevEnvironment" description="Dev environment">        
    		<Application xsi:type="amxdata:Application" name="com.tibco.restbt.sample.bookstore" importBindings="true">						
    			 <PromotedService xsi:type="amxdata_base:Service_base" name="BookStoreResource">
    				<Binding xsi:type="amxdata_binding:RestServiceBinding" name="RESTService_Binding4" contextRoot="mybookstore">
    					<HttpTransportDetails xsi:type="amxdata_binding:HttpTransportDetailsForRestService" httpInboundConnectionJNDIName="newHttpConnector4"/>
    					<OperationConfiguration xsi:type="amxdata_binding:RestOperationConfiguration" name="getBookList" path="/getBookLists" httpMethod="POST" mediaType="XML"/>
    					<OperationConfiguration xsi:type="amxdata_binding:RestOperationConfiguration" name="getBookByTitle" path="/getBooksbytitle" httpMethod="GET"  mediaType="BADGERFISH_JSON"/>
    					<OperationConfiguration xsi:type="amxdata_binding:RestOperationConfiguration" name="addBook" path="/addBook" httpMethod="POST" mediaType="STANDARD_JSON"/>
    				</Binding>		
    			</PromotedService>
            </Application>
        </Environment>
  2. Edit the rest_binding_build.xml to include the add target.
    Sample data for adding a REST binding available in TIBCO_HOME\administrator\<version>\samples\rest_binding_build.xml is shown below:
    <target name="add">
         <AMXAdminTask
              remote="true"
              propsFile="${instanceProperties}"
              action="add"
              dataFile="${dataFile}"
              objectSelector="Environment//Application//Binding"
              overwrite="false"
              merge="false"
              createIfNotExists="true"
              force="true"
              failOnError="false"/>
     </target>
  3. Invoke the add target of the rest_binding_build.xml as shown below:
    ant -f rest_binding_build.xml add

Result

Sample output is shown below:
add:
[AMXAdminTask] 04 Dec 2018 13:37:43  INFO - Initializing JSSE's crypto provider class com.sun.net.ssl.internal.ssl.Provider in default mode
[AMXAdminTask] 04 Dec 2018 13:37:43  INFO - Connecting to AMX Admin server at 'http://WIN-GNKOBQ3CDS3-72:8120' as user 'root'.
[AMXAdminTask] 04 Dec 2018 13:37:44  INFO - Executing action 'add' for 1 objects from data file 'E:\AMX340V46\data_orcl\admin\amxadmin\samples\rest_binding_data.xml'
[AMXAdminTask] 04 Dec 2018 13:37:46  INFO - TIBCO-AMX-CLI-000962: Getting entrprise information before executing action 'add'
[AMXAdminTask] 04 Dec 2018 13:37:46  INFO - ---------------------------------------------------------------------------------
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO - Admin Info:
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Time for which Admin is up: 0 days, 23 hours, 8 minutes, 33 seconds
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Time taken for Admin to start up: 11 minutes, 14 seconds
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Time taken to ping the Database: 0.001 seconds
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Time taken to ping Qin Notification Server: 31ms
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Admin suspend state: Unsuspended
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Admin readOnly state: Write
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Admin suspend/readOnly description:
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Is this Admin Qin Notification Group leader: N/A
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Number of Notifications processed by Admin: 4881
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Number of Runtime Artifacts in Admin Staging Area: 0 (RDA files: 0, ZIP files: 0)
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Admin Entities:
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -                Entities          Total    Last Modified/Deployed On
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -                  Environments        2     03 Dec 2018 14:40:53,790
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -                         Hosts        1     03 Dec 2018 14:32:42,090
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -                         Nodes        2     04 Dec 2018 13:10:37,370
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -                  Applications        5     04 Dec 2018 13:10:37,432
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -            Resource Templates        5     04 Dec 2018 12:26:47,220
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -            Resource Instances       31                          N/A
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -         Application Templates        1     04 Dec 2018 12:48:02,423
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO - Enterprise [amxadmin] summary :
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Number of Nodes: 2 [2 Running, 0 Not Running]
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Number of Hosts: 1 [1 Running, 0 Not Running]
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Number of Applications: 5 [5 Running, 0 Not Running, 0 Not Deployed]
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Number of ActiveMatrix Environments: 2
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Most amount of applications deployed on Node [DevNode] ( managed by [ SystemHost]): 3
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Most amount of applications deployed in Environment [DevEnvironment]: 3
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Most amount of Nodes managed by Host [SystemHost]: 2
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Most amount of Host running on Machine [WIN-GNKOBQ3CDS3-72]: 1
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Most amount of Node running on Machine [WIN-GNKOBQ3CDS3-72]: 2
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     Most amount of applications deployed on Machines [WIN-GNKOBQ3CDS3-72]: 5
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -     CPU and Memory are not collected.
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO -
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO - ---------------------------------------------------------------------------------
[AMXAdminTask] 04 Dec 2018 13:37:47  INFO - Adding Rest service binding...
[AMXAdminTask] 04 Dec 2018 13:37:48  INFO - Successfully added Rest service binding 'RESTService_Binding4'
[AMXAdminTask] 04 Dec 2018 13:37:48  INFO - Action finished at 12/4/18 1:37 PM in 1.731 seconds
 
BUILD SUCCESSFUL