J2EE pattern • Integration
J2EEIntegrationJava example
Web Service Broker solves a specific structural problem in the design.
Shield the application from external web-service protocol details.
Pattern overview
J2EE pattern
Shield the application from external web-service protocol details.
Intent
Encapsulate invocation, transformation, and error handling for external web services.
Problem
External service contracts, retries, and protocol concerns leak into core application code.
Solution
Introduce a broker or gateway that normalizes external calls into internal contracts.
Fit and tradeoffs
FamilyJ2EE
CategoryIntegration
Best used when
- For REST, SOAP, partner APIs, or external platform integrations.
Tradeoffs
- Requires careful ownership so the broker stays focused on integration concerns.
Java example
This example is intentionally compact so the pattern shape stays easy to see.
public final class ShippingBroker {
private final ShippingHttpClient client;
public ShipmentQuote quote(ShipmentRequest request) {
ExternalQuoteResponse response = client.quote(request);
return new ShipmentQuote(response.total(), response.estimatedDays());
}
}