Scrivio Interview library
LeadershipPrincipal5 min read · updated 12 November 2026

Over twenty years, Java web APIs moved from SOAP to REST and now include GraphQL and gRPC. How do you decide which API styles your organisation supports?

I would match the API style to the consumer: REST over HTTP and JSON for broad and external use, gRPC for internal high-volume service-to-service calls, and GraphQL where many client screens need flexible queries over the same data. Each extra style costs tooling, security reviews, monitoring and skills, so the organisation supports a small set with clear guidance on when to use each, invests most in contract design and evolution, and revisits the set when needs change rather than whenever a new style appears.

Why this question is asked

Java teams have lived through SOAP with WSDL, the move to REST, and now GraphQL and gRPC. Each wave arrived with enthusiasm, and many companies ended up supporting all of them half-heartedly. At a senior level, interviewers want to hear how we turn that history into a policy: what each style is good at, what it costs to support, and how to say no without blocking progress. In this answer, we will recap what each style really offers, look at the hidden cost of supporting a style, set a default per kind of consumer, and see why contracts matter more than transport.

1A Quick Recap of the Styles

SOAP is XML messages over HTTP described by a WSDL contract, with standards for security and transactions. It is verbose but strongly typed, and still common in banking, insurance and government integrations. REST models resources with URLs and HTTP methods, usually with JSON, and works with every language, proxy, cache and browser. gRPC sends Protocol Buffers messages over HTTP/2, with contracts in .proto files and generated clients; it is compact and fast and supports streaming, but browsers cannot call it directly without a proxy. GraphQL exposes one endpoint and a typed schema, and the client asks for exactly the fields it needs, which reduces over-fetching for complex UIs but makes caching, rate limiting and query cost control harder.

Spring supports all of these: Spring MVC and WebFlux for REST, Spring for GraphQL, Spring Web Services for SOAP, and gRPC through the Spring gRPC project or community starters; check the current status of the gRPC integration for your Boot version.

Where each style fits
StyleStrengthMain costTypical consumer
REST + JSONUniversal, cacheable, simple toolingChatty for complex screensPartners, public, most services
gRPCCompact, fast, streaming, generated clientsNo direct browser use, binary debuggingInternal high-volume calls
GraphQLClient picks fields, one schemaCaching, query cost, authorisation per fieldRich UIs over many data sources
SOAPStrict contracts, WS-* standardsVerbose, heavy toolingExisting enterprise integrations

2Match the Style to the Consumer

The right question is not which style is best, but who calls this API and what they need. External partners and the public need something every language and tool understands, with stable URLs and good documentation; REST with an OpenAPI spec fits. Internal services calling each other thousands of times per second, often with streaming, benefit from gRPC's compact messages and generated clients. A web and mobile front end that shows the same data in many different shapes may justify a GraphQL layer, often as a gateway in front of REST or gRPC services, owned by the front-end facing team.

SOAP does not get new APIs, but existing integrations stay until the partner moves, because rewriting a working partner integration rarely pays.

3The Hidden Cost of Each Extra Style

Supporting a style in an organisation is much more than adding a library. Each one needs a security review process, gateway support, authentication integration, monitoring and tracing that understand it, contract and breaking-change tooling, client generation, documentation, and people who can review designs and debug production issues. GraphQL, for example, needs query depth and cost limits, or one query can join half the database. gRPC needs load balancing that understands long-lived HTTP/2 connections.

If we multiply that by four styles across 80 services, the platform team is spread thin and each style is supported badly. That is why I would keep a small supported set, for example REST as the default, gRPC for internal high-volume cases, and GraphQL only as a front-end gateway, with written guidance for when to use each and a named team owning each one.

4Contracts Matter More Than Transport

Most of the long-term pain with APIs does not come from the transport. It comes from contracts that were designed poorly or changed carelessly: fields renamed, meanings changed, clients broken. Whatever the style, the same rules apply: the contract is written down in a machine-readable form (OpenAPI, .proto, GraphQL schema, WSDL), changes are additive where possible, breaking changes are detected in CI, and deprecation follows a published process.

So I would invest more in contract design reviews and compatibility checks than in adding styles. A well-designed REST API outlives several transport fashions; a poorly designed gRPC API is just a faster way to break clients.

5When to Revisit the Set

A new style should earn its place with a real need that the supported set cannot meet, shown in a pilot with numbers, for example a 60 percent reduction in payload size for a high-volume internal path, or a front end that makes 12 REST calls per screen. The pilot runs with a named owner and an end date. If the benefit holds, the style joins the set with the full support package; if not, the pilot is retired.

Separately, I would review the whole set every couple of years, including removing styles: if only two old services still use SOAP and their partners have moved, that support can end. Decisions are recorded as architecture decision records so the reasoning survives staff changes.

Step throughAdding a new API style
  1. Team proposes a new styleStates the need and the consumer
  2. Can the supported set meet it?REST, gRPC or GraphQL today
    YesUse the supported styleNoRun a time-boxed pilot
  3. Pilot shows clear gains?Measured, with an owner
    YesAdd with full support packageNoRetire the pilot
  4. Record the decisionArchitecture decision record

4 steps in order. Play them, or step through them one at a time.

6Follow-up questions

Should internal services all use gRPC for performance?

Not by default. For most internal calls, JSON over HTTP is fast enough and much easier to debug, and its tooling is already everywhere. gRPC pays off on hot paths with high volume, strict latency budgets or streaming. Choosing it everywhere adds cost to services that do not need it.

Is GraphQL a replacement for REST?

Usually not. It shines as a client-facing aggregation layer where many screens need different shapes of the same data. Behind it, services still expose REST or gRPC. Replacing all REST APIs with GraphQL would move caching, rate limiting and authorisation complexity into every service.

7Conclusion

In this answer, we saw that SOAP, REST, gRPC and GraphQL each fit a kind of consumer: REST for broad and external use, gRPC for internal high-volume calls, GraphQL for flexible client queries, and SOAP for existing enterprise integrations. Every extra style carries a cost in tooling, security, monitoring and skills, so the organisation should support a small set with clear guidance and owners, put most of its effort into contract design and evolution, and add or remove styles based on measured needs and periodic reviews.

What to say in the interviewAbout 80 seconds aloud

Open with

I'd decide by consumer rather than by trend. For partners and anything public, REST with JSON and an OpenAPI spec is the default, because every language and tool can use it and it's easy to cache and debug.

Then, if they want more

For internal service-to-service calls with high volume or streaming, gRPC can be worth it: compact messages, generated clients, HTTP/2. GraphQL I'd use as a client-facing layer where web and mobile screens need flexible shapes of the same data, usually in front of REST or gRPC services. SOAP stays only for existing integrations.

The important point is that every style has a support cost: security reviews, gateway and auth integration, monitoring, contract tooling and people who can debug it. GraphQL needs query cost limits, gRPC needs HTTP/2 aware load balancing.

So I'd keep the supported set small, give each style a named owner and written guidance on when to use it, and invest most in contract quality, additive changes and breaking-change checks in CI, because contract mistakes hurt more than transport choices.

When someone proposes a new style, they run a time-boxed pilot with measured benefits, and we review the whole set every couple of years, including retiring styles that are no longer needed.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Over twenty years, Java web APIs moved from SOAP to REST and now include GraphQL and...": https://scrivio-interview-library.netlify.app/spring-boot/rest-controllers/73103a3c4e/