Running the rest.extendedJSONConversion Example
- Procedure
- Launch ActiveMatrix Service Grid Administrator.
- Set the TRA property
com.tibco.amf.runtime.bindingtype.rest.extendedJsonConversion
totrue
for the appropriate Runtime Node (via Administrator UI or by adding the linejava.property.com.tibco.amf.runtime.bindingtype.rest.extendedJsonConversion=true
in the .tra file of the Runtime Node) and restart the Runtime Node. - Enable the
com.tibco.amx.bt.rest
logger in the DEBUG level on the Runtime Node. - Create an HTTP Connector Resource Template
httpConnector
with host aslocalhost
and port as9897
. - Create and install the corresponding HTTP Connector Resource Instance “
httpConnector
” on Runtime Node. - For both REST-Java and REST-Java-REST appliations, deploy the following DAA:
/rest-soa-projects/restbt.sample.extended.json.conversion/DeploymentArtifacts/restbt.sample.extended.json.conversion.daa
- To send a REST Request to the
REST-Java
(Provider) App, open the SOAP UI projectREST-ExtendedJSONConversion-soapui-project.xml
using SOAP UI 5.0.0, and use the “InvokeRESTProvider
” service. This sends a REST request to the REST-Java app and demonstrates the Provider-side (Service) behavior.Note: Set the HTTP Request Header toAccept = application/json
.GET method’s RESPONSE (returnOne)
Request URL:
http://localhost:9897/Sample/returnOne
(HTTP method: GET)Sample Response (Standard JSON)
{"returnOneResponse": {"Flights": [{ "Arrival": "arrival", "Departure": "123" }]}}
Note the [ ] indicating that Flights is an Array, based on the schema. Also, “123” is a string, which is schema-compliant.
-
To send a REST Request to the REST-Java-REST (Client) App, open the SOAP UI project REST-
ExtendedJSONConversion-soapui-project.xml
using SOAP UI 5.0.0, and use the “InvokeRESTClient
” service. This sends a REST request to the REST-Java-REST app, which in turn sends a rest to theREST-Java
app. This demonstrates the client-side (Reference) behavior.POST method’s REQUEST (addOperation)
Request URL:
http://localhost:9897/SampleClient/addOperation
(HTTP method: POST)Set HTTP Request Header:
Accept = application/json and Content-Type = application/json
SOAPUI Request to first REST Service Endpoint:
{"addOperation": {"Arrays":[{"Key":"ABC","Value":"123"}]}}
POST Request generated by REST Reference Endpoint:
{"Arrays": [{"Key":"ABC","Value":"123"}]}
Note the [ ] indicating that Arrays is an Array, based on the schema. Also, “123” is a string, based on the schema.
Response (Standard JSON):
{"addOperationResponse": {"Arrays": [{ "Key": "ABC", "Value": "123" }]}}
Note the [ ] indicating that Arrays is an Array, based on the schema. Also, “123” is a string, based on the schema.