Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6592

Kie Server Marshalling changes Pojo field UpperCase begin and JSON

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 7.60.0.Final
    • None
    • kie server
    • None
    • new property to document "org.kie.server.strict.javaBeans.serializers": when set to true, it enables to enforce strict compatibility with Bean name introspection, instead of slightly different mechanism Jackson defaults to.
    • NEW
    • NEW

      It seems payload to/from Kie Server when Domain Object POJO field starts with UpperCase have changed behaviour on 7.59.0.Final.

      Here is a short highlight:

      please notice the difference between the Identifier, Label and JSON payload. This used to work with 7.42.0.Final, just fine. In 7.59.0.Final the behaviour might have changed, and the payload is no longer compatible. Please notice I'm not coming up with the payload by hand, but this is dump from Kie Server Client Java API.

      Follow steps to reproduce.

      Creation of the project on BC, using 7.42.0.Final.
      demo20210908applicant.zip

      The project is a simple Rule that checks the content of Application.Applicant

      Using a Maven based Kie Server Client Java API, to invoke the project once deployed on kie server:
      demo20210908applicant-client.zip

      We can notice the payload (as generated by the Kie Server Client Java API for JSON) uses lowercase for the properties.
      We can notice the behaviour is as-expected, on the server receiving side, each Applicant of the family, has SSN and "US Citizen" fields correctly valorizes.

      Relevant part of the LOG on client side:

      11:25:23.760 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl.makeHttpPostRequestAndCreateServiceResponse:273 - About to send POST request to 'http://localhost:8080/kie-server/services/rest/server/containers/instances/demo20210908applicant_1.0.0-SNAPSHOT' with payload '{
        "lookup" : "ks1",
        "commands" : [ {
          "insert" : {
            "object" : {"com.myspace.demo20210908applicant.Application":{
        "family" : [ {
          "applicantID" : 1,
          "name" : "Jim",
          "address" : "444 St",
          "ssn" : "SSNJim",
          "uscitizen" : true
        }, {
          "applicantID" : 2,
          "name" : "Amy",
          "address" : "444 St",
          "ssn" : "SSNAmy",
          "uscitizen" : true
        }, {
          "applicantID" : 3,
          "name" : "Patrick",
          "address" : "444 St",
          "ssn" : "SSNPatrick",
          "uscitizen" : true
        }, {
          "applicantID" : 4,
          "name" : "Liz",
          "address" : "222 St",
          "ssn" : "SSNLiz",
          "uscitizen" : true
        } ],
        "programName" : null
      }},
            "out-identifier" : "application",
            "return-object" : true,
            "entry-point" : "DEFAULT",
            "disconnected" : false
          }
        }, {
          "fire-all-rules" : {
            "max" : -1,
            "out-identifier" : "numberOfFiredRules"
          }
        } ]
      }'
      11:25:23.773 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl.deserialize:591 - About to deserialize content: 
       '{
        "type" : "SUCCESS",
        "msg" : "Container demo20210908applicant_1.0.0-SNAPSHOT successfully called.",
        "result" : {
          "execution-results" : {
            "results" : [ {
              "value" : {"com.myspace.demo20210908applicant.Application":{
        "family" : [ {
          "applicantID" : 1,
          "name" : "Jim",
          "address" : "444 St",
          "ssn" : "SSNJim",
          "uscitizen" : true
        }, {
          "applicantID" : 2,
          "name" : "Amy",
          "address" : "444 St",
          "ssn" : "SSNAmy",
          "uscitizen" : true
        }, {
          "applicantID" : 3,
          "name" : "Patrick",
          "address" : "444 St",
          "ssn" : "SSNPatrick",
          "uscitizen" : true
        }, {
          "applicantID" : 4,
          "name" : "Liz",
          "address" : "222 St",
          "ssn" : "SSNLiz",
          "uscitizen" : true
        } ],
        "programName" : null
      }},
              "key" : "application"
            }, {
              "value" : 1,
              "key" : "numberOfFiredRules"
            } ],
            "facts" : [ {
              "value" : {"org.drools.core.common.DefaultFactHandle":{
        "external-form" : "0:4:853102085:853102085:4:DEFAULT:NON_TRAIT:com.myspace.demo20210908applicant.Application"
      }},
              "key" : "application"
            } ]
          }
        }
      }' 
       into type: 'class org.kie.server.api.model.ServiceResponse'
      [Applicant [SSN=SSNJim, USCitizen=true, address=444 St, applicantID=1, name=Jim], Applicant [SSN=SSNAmy, USCitizen=true, address=444 St, applicantID=2, name=Amy], Applicant [SSN=SSNPatrick, USCitizen=true, address=444 St, applicantID=3, name=Patrick], Applicant [SSN=SSNLiz, USCitizen=true, address=222 St, applicantID=4, name=Liz]]
      number of fired rules: 1
      demo20210908applicant-client $ 
      

      Import the project on BC, using 7.59.0.Final.
      Update the client application to 7.59.0.Final accordingly:

      We can notice in log the client:

      12:29:17.953 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl.makeHttpPostRequestAndCreateServiceResponse:312 - About to send POST request to 'http://localhost:8080/kie-server/services/rest/server/containers/instances/demo20210908applicant_1.0.0-SNAPSHOT' with payload '{
        "lookup" : "ks1",
        "commands" : [ {
          "insert" : {
            "object" : {"com.myspace.demo20210908applicant.Application":{
        "family" : [ {
          "applicantID" : 1,
          "name" : "Jim",
          "address" : "444 St",
          "ssn" : "SSNJim",
          "uscitizen" : true
        }, {
          "applicantID" : 2,
          "name" : "Amy",
          "address" : "444 St",
          "ssn" : "SSNAmy",
          "uscitizen" : true
        }, {
          "applicantID" : 3,
          "name" : "Patrick",
          "address" : "444 St",
          "ssn" : "SSNPatrick",
          "uscitizen" : true
        }, {
          "applicantID" : 4,
          "name" : "Liz",
          "address" : "222 St",
          "ssn" : "SSNLiz",
          "uscitizen" : true
        } ],
        "programName" : null
      }},
            "out-identifier" : "application",
            "return-object" : true,
            "entry-point" : "DEFAULT",
            "disconnected" : false
          }
        }, {
          "fire-all-rules" : {
            "max" : -1,
            "out-identifier" : "numberOfFiredRules"
          }
        } ]
      }'
      12:29:18.099 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl.deserialize:631 - About to deserialize content: 
       '{
        "type" : "SUCCESS",
        "msg" : "Container demo20210908applicant_1.0.0-SNAPSHOT successfully called.",
        "result" : {
          "execution-results" : {
            "results" : [ {
              "value" : {"com.myspace.demo20210908applicant.Application":{
        "family" : [ {
          "applicantID" : 1,
          "name" : "Jim",
          "address" : "444 St",
          "ssn" : null,
          "uscitizen" : false
        }, {
          "applicantID" : 2,
          "name" : "Amy",
          "address" : "444 St",
          "ssn" : null,
          "uscitizen" : false
        }, {
          "applicantID" : 3,
          "name" : "Patrick",
          "address" : "444 St",
          "ssn" : null,
          "uscitizen" : false
        }, {
          "applicantID" : 4,
          "name" : "Liz",
          "address" : "222 St",
          "ssn" : null,
          "uscitizen" : false
        } ],
        "programName" : null
      }},
              "key" : "application"
            }, {
              "value" : 1,
              "key" : "numberOfFiredRules"
            } ],
            "facts" : [ {
              "value" : {"org.drools.core.common.DefaultFactHandle":{
        "external-form" : "0:1:1057780957:1057780957:1:DEFAULT:NON_TRAIT:com.myspace.demo20210908applicant.Application"
      }},
              "key" : "application"
            } ]
          }
        }
      }' 
       into type: 'class org.kie.server.api.model.ServiceResponse'
      [Applicant [SSN=null, USCitizen=false, address=444 St, applicantID=1, name=Jim], Applicant [SSN=null, USCitizen=false, address=444 St, applicantID=2, name=Amy], Applicant [SSN=null, USCitizen=false, address=444 St, applicantID=3, name=Patrick], Applicant [SSN=null, USCitizen=false, address=222 St, applicantID=4, name=Liz]]
      number of fired rules: 1
      demo20210908applicant-client $ 
      

      that both "SSN" and "US Citizen" valorization are not respected.

      This COULD be related to JBPM-9784

              elguardian@gmail.com Enrique González Martínez (Inactive)
              mmortari@redhat.com Matteo Mortari
              Gonzalo Muñoz Fernández Gonzalo Muñoz Fernández
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: