Manipulate Request and Response

Introduction

The FacetScript Language is one of the Atomic Domain Languages (ADLs).  It is a low level high performance scripting language natively executed by the A-Stack without any additional compilation besides initial parsing.

List of Commands

FacetScript language as well as other domain-specific languages used in Atomiton A-Stack stack is not bound to a specific syntax. Any syntax capable of expressing structure can be used to represent language constructs. Out of the box, both XML and JSON can be used.

Since JSON does not have a concept of attributes, it follows that compiler does not make any distinction between XML elements and attributes either. That is, any XML attribute can be given as an element and any element with text value can be given as an attribute. JSON also does not allow multiple entries of the same name so these must be expressed as JSON arrays.

Recommended syntax to use is XML.

Controlling the Response

You can control the response format setting type modifier. There are really three different scenarios:

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.


Dynamically Set Response Message Type
<DoResponse>
  <Process>
        <Include>RESTHeaders</Include>
          <Message type="[:$Request.Message.Type:]">
            <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.