Sunday, April 19, 2020

Very good reference on using Jersey:
https://dennis-xlc.gitbooks.io/restful-java-with-jax-rs-2-0-en/cn/part1/chapter8/building_and_invoking_requests.html


Do note: need to do a string:
Response resp = invocationBuilder.post(Entity.entity(jsonObjectBody.toString(), MediaType.APPLICATION_JSON)); 

or else json
{"method":"Logon","payload":{"strLogin":"aaa_offers","strPassword":"gL(8KKw3L)\\\"g)BKR","elemParameters":{}},"schema":"xtk:session","securityToken":"","sessionToken":""}


will be converted to like NVP:

{
               "method": {
      "chars": "Logon",
      "string": "Logon",
      "valueType": "STRING"
    },
    "payload": {    
      "strLogin": {
        "chars": "aaa_offers",
        "string": "aaa_offers",
        "valueType": "STRING"
      },
      "strPassword": {
        "chars": "**** password here ****",
        "string": "**** password here ****",
        "valueType": "STRING"
      },
                 "elemParameters": {}
    },
    "schema": {
      "chars": "xtk:session",
      "string": "xtk:session",
      "valueType": "STRING"
    },
    "securityToken": {
      "chars": "",
      "string": "",
      "valueType": "STRING"
    },
    "sessionToken": {
      "chars": "",
      "string": "",
      "valueType": "STRING"
    }
  }

No comments:

Post a Comment