Running the rest.extendedJSONConversion Example
- Launch TIBCO ActiveMatrix Administrator.
- Set the TRA property com.tibco.amf.runtime.bindingtype.rest.extendedJsonConversion to true for the appropriate Runtime Node (via Administrator UI or by adding the line java.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 DEBUG level on the Runtime Node.
- Create a HTTP Connector Resource Template httpConnector with host as localhost and port as 9897.
- Create and Install corresponding HTTP Connector Resource Instance “httpConnector” on Runtime Node.
- For both REST-Java and REST-Java-REST Apps, 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, launch the SOAPUI project
REST-ExtendedJSONConversion-soapui-project.xml using SoapUI 5.0.0, and use the “InvokeRESTProvider” service. This will send a REST request to the REST-Java app and will demonstrate the Provider-side (Service) behavior.
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, launch the SOAPUI project REST- ExtendedJSONConversion-soapui-project.xml using SoapUI 5.0.0, and use the “InvokeRESTClient” service. This will send a REST request to the REST-Java-REST app, which in turn will send a rest to the REST-Java app. This will demonstrate 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.