Create the Tax Request and Response MDCs

In this task, you create the private request and response MDCs to hold the information that comprises the REST request and response.

About this task

All REST requests are derived from the out-of-the-box MtxRequest MDC. The TaxComputeRequest defined here includes the following fields:
  • MsgId
  • CustomerType
  • Location
  • GrossPrice
  • DiscountPrice
  • TaxTreatment
  • Group
  • GroupItemArray

Procedure

  1. Edit the projects/purchase/src/main/resources/extension-rest-mdc.xml file.
  2. Define the private request and response MDCs.
    <configuration>
        <subtype id='TaxTreatmentCode'>
            <datatype>unsigned int32</datatype>
            <value id='1'>inclusive</value>
            <value id='2'>exclusive</value>
        </subtype>
        <container id='TaxComputeRequest'>
            <doc_description>Request container for tax computation.</doc_description>
            <created_schema_version>5050</created_schema_version>
            <base_container id="5050">MtxRequest</base_container>
            <field id='MsgId'>
                <doc_description>Message Id</doc_description>
                <datatype>string</datatype>
                <created_schema_version>5050</created_schema_version>
            </field>
            <field id='CustomerType'>
                <doc_description></doc_description>
                <datatype>signed int32</datatype>
                <created_schema_version>5050</created_schema_version>
            </field>
            <field id='Location'>
                <doc_description>A geo-location code</doc_description>
                <datatype>string</datatype>
                <created_schema_version>5050</created_schema_version>
            </field>
            <field id='GrossPrice'>
                <doc_description></doc_description>
                <datatype>decimal</datatype>
                <created_schema_version>5050</created_schema_version>
            </field>
            <field id='DiscountPrice'>
                <doc_description>Service type</doc_description>
                <datatype>decimal</datatype>
                <created_schema_version>5050</created_schema_version>
            </field>
            <field id='TaxTreatment'>
                <doc_description></doc_description>
                <datatype>unsigned int32</datatype>
                <created_schema_version>5050</created_schema_version>
                <subtype_reference>TaxTreatmentCode</subtype_reference>
            </field>
            <field id='Group'>
                <doc_description>Company group division</doc_description>
                <datatype>string</datatype>
                <created_schema_version>5050</created_schema_version>
            </field>
            <field id='GroupItemArray'>
                <doc_description>Source host</doc_description>
                <datatype>string</datatype>
                <created_schema_version>5050</created_schema_version>
                <array>1</array>
            </field>
        </container>
        <container id='TaxComputeResponse'>
            <doc_description>Response to tax computation</doc_description>
            <created_schema_version>5050</created_schema_version>
            <base_container id="5050">MtxResponse</base_container>
        </container>
    </configuration>
  3. Save the file.

What to do next

Define the tax REST service in the extension-rest-mdc.xml file.