Gopalan Suresh Raj's Web Cornucopia
An Oasis for the parched Enterprise Services Engineer/Developer

    SOA Tips-Expose Coarse-Grained Service Interfaces to external Clients


    Expose Coarse-Grained Service Interfaces to external Clients. Instead of exposing multiple interfaces that effect small state changes in a system, expose fewer service interfaces that can affect complete state changes in the system. This will reduce the volume of data exchanges between a service and its external clients and will significantly reduce the cost of processing the data and improve the latency of network resources in the process. Always hide the details of the applications the service needs to interact with to get a job done by hiding them behind endpoints that expose coarse-grained interfaces. This will allow you to exchange richer business documents between a service and its external clients.

    Exposing service interfaces that are fine-grained could kill system performance. You can get into this situation if you blindly go about exposing your existing EJBs or legacy applications as web-services; something that can unintentionally creep in when you do Implementation-First or Code-First development. Your objective is not to expose getters and setters. Remember that unlike Object-Oriented programming where you are exposing objects, in SOA you are exposing services.

    Here are some strategies that you could adopt: 

    The service that you expose to external clients could perform aggregation on demand and retrieve the data from disparate systems. The Service Interface exposed to the client, when invoked, could aggregate this data from multiple different services and return a consolidated business document to its external clients.

    Or better still, the service that you expose to external clients could also perform aggregation by replication. The aggregating service could contact other services during off-peak hours and replicate the data locally if it is possible. Then when external clients invoke the service it could return the aggregated data as a rich business document in real-time.

    Author Bibliography

    Gopalan Suresh Raj is a Senior Analyst, Software Architect, and Developer with expertise in multi-tiered systems development, enterprise service architectures, and distributed computing. He is also an active author, including contributions to Professional JMS Programming, Wrox Press, 2001, Enterprise Java Computing-Applications and Architecture, Cambridge University Press, 1999, and The Awesome Power of JavaBeans, Manning Publications Co., 1998. He has submitted papers at international fora, and his work has been published in numerous technical journals. Visit him at his Web Cornucopia© site ( or mail him at