dimanche 1 mars 2015

Spring REST representation class

I'm reading the two introductory articles about bulding and consuming Spring Rest web services.


What's weird - they're creating a Greeting representation class in the client app (second link ref) for storing the GET response (the greetingmethod on server side returns a Greeting object). But the Greeting classes on the server and client side are different (client's doesn't have a constructor).


Does it mean I have to actually rewrite the class from stratch when building the client app? If I didn't have the source code of the server's app, then I'd have to know the fields' names and types in order to be able to do that - field names have to perfectly match in order for the unmarshalling to succeed? If I didn't have the source code, I could use reflection API, but I don't think anyone would give me class files.


How is it done in big, real projects?


Aucun commentaire:

Enregistrer un commentaire