Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

InputOutputMessage typeDescription
XML or JSONJSON<Message Type="JSON"/>Forcing the response to JSON irrespective of Input format
JSONXML<Message Type ="XML"/>Forcing the response to XML irrespective of Input format
XML or JSONXML or JSON

<Message Type="XML or JSON"/>

In the TQL/Policy FacetType Definition; Set the Message Type

based on input. Note that Message Type available as part of the Request Object.


Code Block
languagexml
themeEclipse
titleDynamically Set Response Message Type
<if condition="$Request/Message/Type eq 'xml'">
        <then>
           <SetContextData Key="rformat" Value="xml"/>
        </then>
        <else>
           <SetContextData Key="rformat" Value="json"/>
        </else>
      </if>
...

<DoResponse>
  <Process>
        <Include>RESTHeaders</Include>
          <Message type="[:$ContextData$Request.Message.rformatType:]">
            <Value>              <Include>$Response.Message.Value</Include>
            </Value>
          </Message>
        </Process>
</DoResponse>

Forcing the response based on input format; If input is XML; the format will be XML

If input is JSON; the format will be JSON.

...