Conversion API

Internal Jira reference:  PLAT-10136 – REST Endpoint to convert XML to JSON READY FOR TEST

The conversion API is used to convert Enactor entities across xml and JSON formats.

Create XML from JSON Entity #

Creates an XML Enactor entity by converting a JSON Enactor entity. The JSON is deserialized using the class name(FQCN) and the relevant JSON Format. The JSON Format is specified by the optional query parameter jsonFormat (this Defaults to Enactor).

Service Definition:

  • Method – Url – [ POST ] :   /conversion/xml/{CLASS_NAME}?jsonFormat={JSON_FORMAT}
  • Query Parameter
    • {JSON_FORMAT} – The format of the JSON payload – [ENACTOR, TYPED, SIMPLE, QNAME, CLASS]
  • Path variable : 
    • {CLASS_NAME} – Fully qualified class name of the Enactor Entity
  • Body – JSON String 
  • Request Header
    • Content-type : application/json
  • Response
    • Type: application/xml

Example :

::::: REQUEST :::::
[POST] http://localhost:8080/WebRestApi/rest/conversion/xml/com.enactor.mfc.productMedia.ProductMedia?jsonFormat=SIMPLE
{
  "@qname": "retail:productMedia",
  "productMediaId": "FPCS7PX-M1",
  "productId": {
    "@qname": "retail:productKey",
    "id": "FPCS7PX"
  },
  "sortIndex": 1,
  "mediaType": "IMAGE",
  "mediaSubtype": "LARGE",
  "name": "FPCS7PX-M1",
  "mediaKey": {
    "imageKey": {
      "category": "PRODUCT",
      "id": "1_FPCS7PX",
      "type": "jpg"
    }
  }
}
 
::::: RESULT :::::
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:productMedia xmlns:ns2="http://www.enactor.com/retail" xmlns:ns3="http://www.enactor.com/core" xmlns:ns4="http://www.enactor.com/crm" xmlns:ns5="http://docs.oasis-open.org/wsbpel/2.0/serviceref" xmlns:ns6="http://www.enactor.com/retail/storedRestaurantSaleTransaction/service" xmlns:ns7="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803" xmlns:ns8="http://www.enactor.com/retail/restaurantTableStatus/service" xmlns:ns9="http://www.enactor.com/orders" xmlns:ns10="http://www.enactor.com/retail/storedRetailTransaction/service" xmlns:ns11="http://www.enactor.com/addressLookup/service" xmlns:ns12="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/200803" xmlns:ns13="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/types/200803" xmlns:ns14="http://www.enactor.com/crm/customerLoyalty/service" xmlns:ns15="http://www.enactor.com/tools">
<ns2:productMediaId>FPCS7PX-M1</ns2:productMediaId>
<ns2:productId>FPCS7PX</ns2:productId>
<ns2:sortIndex>1</ns2:sortIndex>
<ns2:mediaType>IMAGE</ns2:mediaType>
<ns2:mediaSubtype>LARGE</ns2:mediaSubtype>
<ns2:name>FPCS7PX-M1</ns2:name>
<ns2:imageKey type="jpg" category="PRODUCT">1_FPCS7PX</ns2:imageKey>
</ns2:productMedia>

Go to Top