Skip to Content
1
Sep 04, 2020 at 02:04 PM

Smarteditwebservices retruns configuration in an XML instead of JSON

276 Views

Hi

SAP Commerce version 1811.18

We have installed Smartedit on our SAP Commerce and we can see the login screen our domains /smartedit. When entering credentials and trying to log in we see error in fetching the Smartedit Configurations.

ERROR [hybrisHTTP38] [RestHandlerExceptionResolver] com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

at [Source: (String)"<?xml version='1.0' encoding='UTF-8'?><configurationDataListWsDto><configurations><key>applications.cmssmartedit</key><value>{"smartEditLocation":"/cmssmartedit/cmssmartedit/js/cmssmartedit.js"}</value></configurations><configurations><key>applications.cmssmarteditContainer</key><value>{"smartEditContainerLocation":"/cmssmartedit/cmssmartedit/js/cmssmarteditContainer.js"}</value></configurations><configurations><key>previewTicketURI</key><value>"/previewwebservices/v1/preview"</value></configura"[truncated 203 chars]; line: 1, column: 2]

at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)

at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:693)

at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:591)

at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1902)

at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:757)

at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4142)

at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)

at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3005)

at de.hybris.smartedit.controllers.ConfigurationController.getConfiguration(ConfigurationController.java:89)

Configurations are requested from smarteditwebservices extensions which should return JSON and does, when we curl the configuration address:

{
   "configurations" : [ {
      "key" : "applications.cmssmartedit",
      "value" : "{\"smartEditLocation\":\"/cmssmartedit/cmssmartedit/js/cmssmartedit.js\"}"
   }, {
      "key" : "applications.cmssmarteditContainer",
      "value" : "{\"smartEditContainerLocation\":\"/cmssmartedit/cmssmartedit/js/cmssmarteditContainer.js\"}"
   }, {
      "key" : "previewTicketURI",
      "value" : "\"/previewwebservices/v1/preview\""
   }, {
      "key" : "defaultToolingLanguage",
      "value" : "\"en\""
   }, {
      "key" : "whiteListedStorefronts",
      "value" : "[]"
   } ]
}

Somehow smartedit extension receives these configurations in XML like this:

<?xml version='1.0' encoding='UTF-8'?>
    <configurationDataListWsDto>
        <configurations>
            <key>applications.cmssmartedit</key>
            <value>{"smartEditLocation":"/cmssmartedit/cmssmartedit/js/cmssmartedit.js"}</value>
        </configurations>
        <configurations>
            <key>applications.cmssmarteditContainer</key>
            <value>{"smartEditContainerLocation":"/cmssmartedit/cmssmartedit/js/cmssmarteditContainer.js"}</value>
            </configurations>
        <configurations>
            <key>previewTicketURI</key>
            <value>"/previewwebservices/v1/preview"</value>
        </configurations>
        <configurations>
            <key>defaultToolingLanguage</key>
            <value>"en"</value>
        </configurations>
        <configurations>
            <key>whiteListedStorefronts</key>
            <value>[]</value>
        </configurations>
    </configurationDataListWsDto>

In de.hybris.smartedit.controllers.ConfigurationController.getConfiguration this XML data is passed to a mapper which expects JSON and the error in the start of the question arises.

Why does smarteditwebservices return XML although it's says in every documentation that it produces JSON? What can we do to fix this?