Search code examples
javarestresteasyjersey-client

Rest client framework for complex objects


I have developed one web service for order management. This web service takes many complex objects as input parameters. I used curl to test and it works fine. Now I am writing a client but having issue when for ArrayList (e.g. the items are coming as ArrayList) objects. It's sending as String. It's seems the limitation the client framework I am using. I have tried one or two open frameworks but they are not working as expected. It will be great if you can suggest some framework with some examples.

Below is the sample curl request, I have removed some extra parameters to keep it simple.

curl -L -v -b agent_cookies.txt -H "Content-Type: application/json" -d "{"items":{"atg-rest-class-type":"java.util.ArrayList","atg-rest-values": [{"atg-rest-class-type":"com.bean.CommerceItemInfo","tinSkuNumber":"41589367","itemNumber": 280594,"color": 9,"size": 94,"salePrice":50.00,"taxAmount":3.5,"stateTax":0.48,"countyTax":0.08,"currencyCode":"USD"},{"atg-rest-class-type":"com..bean.CommerceItemInfo", "tinSkuNumber":"41589375","itemNumber": 280594,"color": 9,"size": 96,"salePrice":100.00,"taxAmount":7,"stateTax":0.96,"countyTax":0.16,"currencyCode":"USD"}]},orderInfo:{...},"clientAddress":{"atg-rest-class-type":"java.util.ArrayList","atg-rest-values": [{"atg-rest-class-type":"com.bean.ClientAddress",\"firstName\":\"John\",\"lastName\":\"Dao\",\"state\":\"FL\",\"country\":\"US\",\"postalCode\":\"33606\",\"address1\":\"100 S Edison Avenue\",\"address2\":\"Suite D\",\"city\":\"Tampa\",\"addressType\":\"BOTH\"}]},{......}}" http://localhost:8080/rest/model/com/web/actor/CartActor/testOrder

Thank you


Solution

  • After some research I found the limitation of ATG client and no way we can send List.I changed the arguments to accept individual beans only.