Webservice: Returning Polymorphic types in response and reference client implementation October 9, 2015Posted by javafoo in java, webservice.
Tags: jsonprovider, polymorphism, webservices
First let me get this off my chest. You have this fabulous rest service that works flawlessly, sure everything works in SOAP UI. But do you have a reference client implementation, do you eat your own dog food.
Currently working with this other team that we need to integrate with. They have a rest service that has polymorphic types in the response and there is no type differentiator in the json string. We are running into all sorts of unmarshaling issues because of this. Switched out different JSONProviders (Jackson/Jettison), still no luck. Sure there are ways to get around it, custom adapters, deserialzers whatnot. But figuring out how to plug them in can be a pain with scant documentation and when you are doing 2 week sprints. We are a java shop and asked them if they have a reference client implementation in java, since they are too and they said no, but everything works in SOAP UI and for our 1 client that uses dot net.
Please don’t do this to your customers. Atleast have a reference client implementation and don’t do polymorphic types in responses, atleast not without type differentiators.