Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    JSON error message missing in API response

    After upgrading to SmartGWT 13, we no longer receive an error response via the API using JSON.

    This is verifiable in our software and in the latest built-in-ds.

    To make it easier to understand, I'll use the built-in-ds example.


    I have created the following class as a DMI, including the error return as specified in the Quickstart Guide, among other things:
    Code:
    package com.smartgwt.sample.server;
    
    import com.isomorphic.datasource.DSRequest;
    import com.isomorphic.datasource.DSResponse;
    
    public class AnimalsDMI {
    
    
        public DSResponse fetchAnimals(DSRequest dsRequest) throws Exception {
    
    
            if(dsRequest.getFieldValue("id") == null || dsRequest.getFieldValue("id").toString().equals("")) {
    
                DSResponse dsResponse = new DSResponse();
                dsResponse.setStatus(DSResponse.STATUS_VALIDATION_ERROR);
                dsResponse.addError("commonName", "Error, commonName-Field not set!");
                return dsResponse;
            }
    
            return dsRequest.execute();
    
        }
    }

    I have also extended animals.ds.xml as follows:
    Code:
    <operationBindings>
            <operationBinding operationType="fetch">
                <serverObject className="com.smartgwt.sample.server.AnimalsDMI" methodName="fetchAnimals"/>
            </operationBinding>
    </operationBindings>

    and finally adapted the web.xml and the RESTHandler servlet as follows:
    Code:
    <servlet>
            <servlet-name>RESTHandler</servlet-name>
            <servlet-class>com.isomorphic.servlet.RESTHandler</servlet-class>
            <init-param>
                <param-name>defaultDataFormat</param-name>
                <param-value>xml</param-value>
            </init-param>
            <init-param>
                <param-name>dynamicDataFormatParamName</param-name>
                <param-value>theDataFormat</param-value>
            </init-param>
            <init-param>
                <param-name>wrapJSONResponses</param-name>
                <param-value>false</param-value>
            </init-param>
    </servlet>

    My following query with XML:
    Code:
    curl --location 'http://127.0.0.1:8888/builtinds/sc/RESTHandler?theDataFormat=xml' \
    --header 'Content-Type: application/xml' \
    --header 'Cookie: isc_cState="ready"' \
    --data '<?xml version="1.0" encoding="UTF-8"?>
    <root>
       <data />
       <dataSource>animals</dataSource>
       <operationType>fetch</operationType>
    </root>'

    returns the following result:
    Code:
    <?xml version="1.0"?>
    <response>
        <queueStatus>-1</queueStatus>
        <status>-4</status>
        <errors>
            <commonName>
                <errorMessage>Error, commonName-Field not set!</errorMessage>
            </commonName>
        </errors>
        <data></data>
    </response>

    in JSON:
    Code:
    curl --location 'http://127.0.0.1:8888/builtinds/sc/RESTHandler?theDataFormat=json' \
    --header 'Content-Type: application/json' \
    --header 'Cookie: isc_cState="ready"' \
    --data '{
       "data":{
       },
       "dataSource":"animals",
       "operationType":"fetch",
       "operationId": "fetchAnimals"
    }'

    the error message is missing here, only the status was apparently adopted:
    Code:
    {
        "response": {
            "queueStatus": -1,
            "status": -4,
            "startRow": null,
            "endRow": null,
            "totalRows": null,
            "data": null
        }
    }

    We would be grateful for any help.

    #2
    Isomorphic Could you give us some feedback on this?
    We can of course provide further information if you need anything else.
    The topic is actually very relevant for us right now.

    Comment


      #3
      It has been assigned to be looked at. However, you didn't give your full version, which is always required. You should test with the latest patched build (see smartclient.com/builds) and let us know if you still see the problme.

      Comment


        #4
        I now tried it with the following versions:
        - SNAPSHOT_v13.1d_2024-07-08/PowerEdition Deployment (built 2024-07-08)
        - v13.0p_2024-07-07/PowerEdition Deployment (built 2024-07-07)
        - v13.0p_2024-04-03/PowerEdition Deployment (built 2024-04-03)

        The problem still occurs.

        Comment


          #5
          Isomorphic Are these versions enough for the topic to be checked?
          We will of course be happy to provide further information if there are any questions.
          We look forward to your feedback.

          We tried it again with version v13.0p_2024-07-20/PowerEdition Deployment (built 2024-07-20)

          Comment


            #6
            Thanks for checking on those other versions.

            You seem to be posting from an account that doesn't have Support (let us know if this is incorrect), so, you are queued up behind issues and questions from other customers. We can't give an ETA.

            Comment


              #7
              Isomorphic We enquired about support on Sunday and have since booked and paid.

              Comment


                #8
                Thanks for supporting our team!

                You're issue has been bumped to the top of the queue and should be resolved shortly.

                Comment


                  #9
                  Thanks for the clear repro case, and for being a Support customer. This issue has been resolved, the fix will be in 13.0 builds as of tomorrow (builds dated July 26th and later)

                  Regards,
                  Isomorphic Software Support

                  Comment


                    #10
                    We have looked at this and the feedback now matches what it was before. That's fixed for us now.
                    Thanks for the help and the quick fix and provision.

                    Comment

                    Working...
                    X