Reputation: 17161
This is a design question.
We are implementing a REST-ful Web Service in Java, and our design will separate the thin service layer from the domain layer. Our domain layer can be encapsulated in its own .jar because it is completely separate and unaware of the service layer. The service layer will be servicing some of our non-Java clients, and I want to know, is it poor design to allow Java clients to directly use the Java API? In my opinion it isn't necessary for the Java software to go through a web service, but one could argue that the web service is a more standardized interface and all software should go through it. Can I have some reasons for or against allowing Java clients to directly use the domain layer API?
Upvotes: 0
Views: 73
Reputation: 2987
I believe you answered your own question (in a way atleast).
but one could argue that the web service is a more standardized interface and all software should go through it.
Webservices are definitely a lot more standardized interface for ALL clients regardless of the platform they have build their client on (java, C#, asp.net, php etc). You COULD still expose your java apis through RMI (see here What is rmi registry) and let your JAVA CLIENTS use these apis, but along with exposing these APIs they will have to keep up with any changes that you make to your POJOs or domain classess that they consume over the wire by making these RMI calls (otherwise they will get the serialversionUID not matching errors). This is more of a pain because you will have to start sharing your domain classes in some way with your clients (centralize the .jar of your domain classes on some maven repository that they will have access to).
All in all, Webservices is a much cleaner way. That would be my 2 cents
Upvotes: 1