CentraSite Documentation : Runtime Governance with CentraSite : Important Considerations when Configuring REST or XML Virtual Services : Working with the JSON Content-Type : JSON Example 2: POST/JSON Request, JSON Response (where POST is not supported)
JSON Example 2: POST/JSON Request, JSON Response (where POST is not supported)
In this example, a consumer sends a POST request (of Content-Type application/json) to a native service, but the native service does not support POST.
The request's Content-Type is application/json and its output parameter is set to xml. The reason for this is explained below.
The run-time processing will be as follows:
Consumer Sends
Mediator Sends Request to Provider
Mediator Receives Response from Provider
Mediator Sends Response to Consumer
Requirement for Bridging
POST/JSON
GET
XML
JSON
*Request Processing step bridging
*Response Processing step bridging
Configure the virtual service as follows:
*In the virtual service's Routing Protocols tab, set the value of the HTTP Method field to the value GET. Doing this instructs Mediator to change the POST to an HTTP GET before Mediator sends it to the native service (which is necessary because the native service does not support POST).
*Write and invoke a webMethods IS service in the virtual service’s Invoke webMethods IS Service action. The IS service should include the following predefined context variables set to the values shown below. The request's "query": "wsdl20" and "output": "xml" parameters are transformed into query parameters on the URL before the native service is invoked. Thus, although the consumer is sending a JSON request, the native service is instructed to return an XML response to Mediator.
Context Variable
Value
MESSAGE_TYPE
application/x-www-form-urlencoded
BUILDER_TYPE
application/xml
*Write and invoke a webMethods IS service in the virtual service’s Invoke webMethods IS Service action. The IS service should include the following predefined context variable set to the value shown below. Doing this instructs Mediator to bridge the XML response from the native service into JSON format, to be returned to the consumer:
Context Variable
Value
MESSAGE_TYPE
application/json
Copyright © 2005-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback