0

I am using spring-web-4.3.10.RELEASE library.

I call postForEntity() method of RestTemplate (entity returns by getRestOperations()) from this library like this:

getRestOperations().postForEntity(getEndpoint(), new HttpEntity<String>(requestStr, headers), String.class);

But the response is returned incorrect (tested by some tools like SOAP UI)

Json with an array [] that is expected:

{
  "Header": {
    "Security": {
      "Timestamp": {
        "Created": "2019-05-27T13:16:57Z",
        "Expires": "2019-05-27T13:18:27Z"
      }
    }
  },
  "Body": {
    "NResponse": {
      "NoteInqRec": [
        {
          "NoteInfo": {
            "BranchDetails": ""
          }
        },
        {
          "NoteInfo": {
            "BranchDetails": ""
          }
        }
      ]
    }
  }
}

And the response from code using spring-web lib I got (the json returned is not even valid):

{
  "Header": {
    "Security": {
      "Timestamp": {
        "Created": "2019-05-27T13:16:57Z",
        "Expires": "2019-05-27T13:18:27Z"
      }
    }
  },
  "Body": {
    "NResponse": {
      "NoteInqRec": 
        {
          "NoteInfo": {
            "BranchDetails": ""
          }
        },
        "NoteInqRec":
        {
          "NoteInfo": {
            "BranchDetails": ""
          }
        }
    }
  }
}

Please, assist

0 Answers0