Troubleshooting problems with JSON requests

If CICS® is rejecting JSON, whether as an input message to a web service or when used with the linkable interface to transform JSON, the JSON might be invalid or not conforming to the schema.

About this task

If CICS encounters a problem with JSON provided by a web service requester or an application program, an error message is return with details of the problem. When CICS is acting as a web service provider, the error message is returned to the client application as a JSON response. For more information, see Error responses returned to the client. When an application calls the linkable interface to transform JSON, an error code is returned in the DFHJSON-ERROR container and a detailed message in the DFHJSON-ERRORMSG container. For more information, see JSON transformer linkable interface. In both cases the troubleshooting steps are the same and depend on the type of error.

Procedure

  • Check that your JSON conforms to the restrictions imposed by CICS. For more information, see JSON web service restrictions .
  • If a JSON parsing error occurs, check that the JSON is well-formed. The error message provides details of the problem, such as:

    "Expected a ',' or '}' at character 44 of {"inquireCatalogRequest": "myData }

    You could use a tool to validate the JSON syntax, for example JSONLint.
  • If CICS detects a structural error when it is trying to map JSON to application data, a DFHPI1007 message is issued providing details of the error.
    For example:

    DFHPI1007 04/19/2013 15:14:42 IYK2ZKE1 00112 JSON to data transformation failed because of incorrect input (UNDEFINED_ELEMENT Operation) for WEBSERVICE SimpleMappings.

    Check that the JSON contains the JSON objects and properties that are described by the schema you provided to DFHJS2LS, or that was generated by DFHLS2JS. You could use a tool to validate that the JSON conforms to the schema.

  • If no error occurs, but your application receives empty data for some fields, check that the corresponding JSON was provided. CICS will not detect the absence of JSON properties described by the schema. You could use a JSON validation tool to check this as described earlier.
  • An Internal server error is encountered.
    Internal Server Error
    
    CICS TS: Unhandled Pipeline Error
    
    Release: 670
    In the browser, check for message DFHSJ1006. Check that the JVMServer exists and is not disabled.
  • In some circumstances. CICS adds a wrapper element to the JSON request or response during internal processing. This will never be visible to the application, but can sometimes occur in error messages.
    For example:
    "Error obtaining parser from data source:Expected a ':' 
    after a key at character 25 of {\"DFHWrapper\": { l2jb01c\":"...
    In these situations the DFHWrapper element should be ignored when determining the cause of the error.

What to do next

After you have corrected your JSON, rerun the application.