CentraSite Documentation : Runtime Governance with CentraSite : Important Considerations when Configuring REST or XML Virtual Services : Working with the JSON Content-Type
Working with the JSON Content-Type
 
How Mediator Determines Which Builder and Formatter Classes to Use (and How You Can Override Them)
Scenarios for Requesting JSON Type Services
JSON Example 1: GET Request, JSON Response
JSON Example 2: POST/JSON Request, JSON Response (where POST is not supported)
JSON Example 3: GET Request, XML Response
Characteristics of the Mapped and Badgerfish JSON Conventions
Multiple Root Nodes in JSON REST Services
Mediator can accept a REST service request that specifies the Content-Type "application/json" (or "application/json/badgerfish") and the HTTP methods PUT, GET, DELETE and POST.
Assuming that the native service supports both JSON and the HTTP method(s) specified in the request, Mediator can determine the correct service, operation and output format (JSON) to return to the consuming application. There are different ways in which a native service provider can be prompted to return response content. It will vary with the provider. For example, some providers may rely on the Accept transport header to specify the format the consumer wants. Others may use an element in the request or a query parameter on the URL.
However, suppose for example that the native service does not support the HTTP method specified in the request (e.g., POST). As a workaround, you can configure the virtual service so that it "bridges" this difference between the consumer request and the native service. In this case, you can configure the virtual service so that it takes the POST and bridges it into an HTTP GET query, and then returns the service to the consumer in the expected JSON format. To implement this, you set the following predefined context variables in a user-defined webMethods IS service that you can invoke in the virtual service’s Invoke webMethods IS Service action:
*MESSAGE_TYPE: A Content-Type defined in axis2.xml for a message formatter. This value must be a key in the axis2 message formatters list, since it is used to control message serialization. (The valid choices are defined as attributes of the <messageFormatters/> group in the Integration Server's axis2.xml configuration.)
*BUILDER_TYPE: A Content-Type defined in axis2.xml for a message builder. This value must be a key in the axis2 message builders list since it is used to control building of native service response messages. (The valid choices are defined as attributes of the <messageBuilders/> group in the Integration Server's axis2.xml configuration.)
This and other "bridging" scenarios are discussed in this section.
Copyright © Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback