Create JSON from XML 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/json?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/xml
- Response
- Type: application/json
Example :
::::: REQUEST :::::
[POST] http://localhost:8080/WebRestApi/rest/conversion/json?jsonFormat=QNAME
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<retail:productMedia xmlns:core="http://www.enactor.com/core" xmlns:hta="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803" xmlns:htd="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/200803" xmlns:htt="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/types/200803" xmlns:ns11="http://www.enactor.com/retail/restaurantTableStatus/service" xmlns:ns13="http://www.enactor.com/crm/customerLoyalty/service" xmlns:ns3="http://www.enactor.com/retail/storedRetailTransaction/service" xmlns:ns6="http://www.enactor.com/crm" xmlns:ns8="http://www.enactor.com/addressLookup/service" xmlns:ns9="http://www.enactor.com/retail/storedRestaurantSaleTransaction/service" xmlns:retail="http://www.enactor.com/retail" xmlns:sref="http://docs.oasis-open.org/wsbpel/2.0/serviceref" xmlns:tools="http://www.enactor.com/tools" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<retail:productMediaId>FPCS7PX-M1</retail:productMediaId>
<retail:productId>FPCS7P34534543X</retail:productId>
<retail:mediaType>IMAGE</retail:mediaType>
<retail:mediaSubtype>LARGE</retail:mediaSubtype>
<retail:name>FPCS7PX-M1</retail:name>
<retail:imageKey type="jpg" category="PRODUCT">1_FPCS7PX</retail:imageKey>
</retail:productMedia>
::::: RESULT :::::
{
"@qname": "retail:productMedia",
"productMediaId": "FPCS7PX-M1",
"productId": {
"@qname": "retail:productKey",
"id": "FPCS7P34534543X"
},
"sortIndex": 1,
"mediaType": "IMAGE",
"mediaSubtype": "LARGE",
"name": "FPCS7PX-M1",
"mediaKey": {
"imageKey": {
"category": "PRODUCT",
"id": "1_FPCS7PX",
"type": "jpg"
}
}
}
How to determine Fully Qualified Class Name of an Enactor Entity #
The easiest way to find out the fully qualified class name of an Enactor entity is to search for it in the jar files.
For instance:
> jar tf mfc-2.7-SNAPSHOT.jar | grep "/ProductMedia.class"
com/enactor/mfc/productMedia/ProductMedia.class
Or to search in all jar files (e.g. navigate to the enactor-lib folder of an Enactor POS)
> find . -name "*.jar" | xargs -n 1 jar tf | grep "/ProductMedia.class"
com/enactor/mfc/productMedia/ProductMedia.class
The fully qualified class name is then obtained by replacing the slash by dot
com.enactor.mfc.productMedia.ProductMedia